[
  {
    "path": ".gitignore",
    "content": "# Xcode\n#\n# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore\n\n## Build generated\nbuild/\nDerivedData/\n\n## Various settings\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.perspectivev3\n!default.perspectivev3\nxcuserdata/\n\n## Other\n*.moved-aside\n*.xccheckout\n*.xcscmblueprint\n\n## Obj-C/Swift specific\n*.hmap\n*.ipa\n*.dSYM.zip\n*.dSYM\n\n## Playgrounds\ntimeline.xctimeline\nplayground.xcworkspace\n\n# Swift Package Manager\n#\n# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.\n# Packages/\n# Package.pins\n.build/\n\n# CocoaPods\n#\n# We recommend against adding the Pods directory to your .gitignore. However\n# you should judge for yourself, the pros and cons are mentioned at:\n# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control\n#\n# Pods/\n\n# Carthage\n#\n# Add this line if you want to avoid checking in source code from Carthage dependencies.\n\nCarthage/Checkouts\n\nCarthage/Build\n\n# fastlane\n#\n# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the\n# screenshots whenever they are needed.\n# For more information about the recommended setup visit:\n# https://docs.fastlane.tools/best-practices/source-control/#source-control\n\nfastlane/report.xml\nfastlane/Preview.html\nfastlane/screenshots\nfastlane/test_output\n\n.build\nDerivedData\n/.previous-build\nxcuserdata\n.DS_Store\n*~\n\\#*\n.\\#*\n.*.sw[nop]\n*.xcscmblueprint\n/default.profraw\n*.xcodeproj\nUtilities/Docker/*.tar.gz\n.swiftpm\nPackage.resolved\n/build\n*.pyc\n"
  },
  {
    "path": ".travis.yml",
    "content": "# references:\n# * http://www.objc.io/issue-6/travis-ci.html\n# * https://github.com/supermarin/xcpretty#usage\n\nosx_image: xcode8.3\nlanguage: objective-c\n# cache: cocoapods\n# podfile: Example/Podfile\n# before_install:\n# - gem install cocoapods # Since Travis is not always on latest version\n# - pod install --project-directory=Example\nscript:\n- set -o pipefail && xcodebuild test -enableCodeCoverage YES -workspace Example/ErrorHandler.xcworkspace -scheme ErrorHandler-Example -destination \"OS=10.3.1,name=iPhone 7 Plus\" ONLY_ACTIVE_ARCH=NO | xcpretty\n- pod lib lint\n"
  },
  {
    "path": "Cartfile",
    "content": "github \"Alamofire/Alamofire\" ~> 4.1\n"
  },
  {
    "path": "Cartfile.resolved",
    "content": "github \"Alamofire/Alamofire\" \"4.5.0\"\n"
  },
  {
    "path": "ErrorHandler/Assets/.gitkeep",
    "content": ""
  },
  {
    "path": "ErrorHandler/Classes/.gitkeep",
    "content": ""
  },
  {
    "path": "ErrorHandler/Classes/Alamofire/AFErrorStatusCodeMatcher.swift",
    "content": "//\n//  ErrorHandler-AFExtensions.swift\n//  Workable SA\n//\n//  Created by Kostas Kremizas on {TODAY}.\n//  Copyright © 2017 Workable SA. All rights reserved.\n//\n\nimport Foundation\nimport Alamofire\n#if !COCOAPODS\n    import ErrorHandler\n#endif\n\npublic class AFErrorStatusCodeMatcher: ErrorMatcher {\n    \n    private let validRange: Range<Int>\n    \n    public init(_ range: Range<Int>) {\n        self.validRange = range\n    }\n    \n    public init(statusCode: Int) {\n        self.validRange = statusCode..<statusCode + 1\n    }\n    \n    public func matches(_ error: Error) -> Bool {\n        guard let error = error as? AFError else { return false }\n        guard case .responseValidationFailed(reason: let validationFailureReason) = error else { return false }\n        guard case .unacceptableStatusCode(code: let statusCode) = validationFailureReason else { return false }\n        return validRange ~= statusCode\n    }\n}\n"
  },
  {
    "path": "ErrorHandler/Classes/Alamofire/ErrorHandler+AFExtensions.swift",
    "content": "//\n//  ErrorHandler+AFExtensions.swift\n//  ErrorHandler+AFExtensions\n//\n//  Created by Kostas Kremizas on 30/08/2017.\n//  Copyright © 2017 Workable SA. All rights reserved.\n//\n\nimport Foundation\n#if !COCOAPODS\n    import ErrorHandler\n#endif\n\npublic extension ErrorHandler {\n    \n    func onAFError(withStatus statusCode: Int, do action: @escaping ErrorAction) -> ErrorHandler {\n        let matcher = AFErrorStatusCodeMatcher(statusCode: statusCode)\n        return self.on(matcher, do: action)\n    }\n    \n    func onAFError(withStatus range: Range<Int>, do action: @escaping ErrorAction) -> ErrorHandler {\n        let matcher = AFErrorStatusCodeMatcher(range)\n        return self.on(matcher, do: action)\n    }\n}\n"
  },
  {
    "path": "ErrorHandler/Classes/Core/ErrorHandler.swift",
    "content": "//\n//  ErrorHandlerClass.swift\n//  workable\n//\n//  Created by Kostas Kremizas on 09/05/16.\n//  Copyright © 2016 Workable. All rights reserved.\n//\n\nimport Foundation\n\npublic enum MatchingPolicy {\n    case continueMatching\n    case stopMatching\n}\n\npublic typealias ErrorAction = (Error) -> MatchingPolicy\n\npublic typealias Tag = String\n\n/**\n An ErrorHandler is responsible for handling an error by executing one or more actions, that are found to match the error.\n \n You can add the rules for matching and the actions that will be executed when a match occurs by using the `on(_:do)` method variants.\n \n You can add actions to be executed when there is no match with the onNoMatch(do:) method and actions that will be executed regardless of whether there is a match or not with `always(do:).`\n */\nopen class ErrorHandler {\n    fileprivate var errorActions: [(ErrorMatcher, ErrorAction)] = []\n    fileprivate var onNoMatch: [ErrorAction] = []\n    fileprivate var alwaysActions: [ErrorAction] = []\n    \n    fileprivate var tagsDictionary = [Tag: [ErrorMatcher]]()\n    \n    public init() {\n    }\n    \n    /**\n     Defines an action to be executed if the error handled by the error handler metches the `matches` function.\n     - Parameters:\n         - matches: If this closure returns true, the `action` parameter will be executed.\n         - action: The closure that will be executed if `matches` returns true. The action returns a `MatchingPolicy` instance. If the action is called and returns `MatchingPolicy.continueMatching`, the error handle continues to execute the actions corresponding to other potential matches for the handled error. If the action is called and returns `MatchingPolicy.stopMatching` no other matching action is executed, except actions defined with the `always(do:)` method.\n     - Returns: The updated error handler (self).\n     - Note: When the `handle` method is called the matching functions are called in lifo order. First is checked the `matches` function given by the last `on(matches:do:)` call. The reasoning behind this is that the last `on(matches:do:)` call is the last customization made to the handler by the developer and as such, it's action should have priority if there are multiple matches.\n     */\n    public func on(matches: @escaping ((Error) -> Bool), do action: @escaping ErrorAction) -> ErrorHandler {\n        let matcher = ClosureErrorMatcher(matches: matches)\n        return on(matcher, do: action)\n    }\n    \n    /**\n     Defines an action to be executed if the `matcher` matches the error handled by the error handler.\n     - Parameters:\n         - matcher: The matcher that defines if the `action` closure will be called (if it's `matches` function returns true).\n         - action: The closure that will be executed if the `matcher` matches the error. The action returns a `MatchingPolicy` instance. If the action is called and returns `MatchingPolicy.continueMatching`, the error handle continues to execute the actions corresponding to other potential matches for the handled error. If the action is called and returns `MatchingPolicy.stopMatching` no other matching action is executed, except actions defined with the `always(do:)` method.\n     - Returns: The updated error handler (self).\n     - Note: When the `handle` method is called the matching functions are called in lifo order. First is checked the `matches` function given by the last `on(_:do:)` call. The reasoning behind this is that the last `on(matches:do:)` call is the last customization made to the handler by the developer and as such, it's action should have priority if there are multiple matches.\n     */\n    public func on(_ matcher: ErrorMatcher, do action: @escaping ErrorAction) -> ErrorHandler {\n        errorActions.append((matcher, action))\n        return self\n    }\n    \n    /**\n     Adds an action to be executed if there is no match for the error being handled.\n     - Parameters:\n         - action: The closure that will be executed if there is no match. The action returns a `MatchingPolicy` instance. If the action is called and returns `MatchingPolicy.continueMatching`, the error handle continues to execute the previously added `onNoMatch` actions. If the action is called and returns `MatchingPolicy.stopMatching` no other `onNoMatch` action is executed. This way you can override previously defined `onNoMatch` actions.\n     - Returns: The updated error handler (self).\n     - Note: You can add multiple `onNoMatch` actions and they will be executed in lifo order until one of them returns MatchingPolicy.stopMatching. The reasoning behind this is that the last `onNoMatch` call is the last customization made to the handler's `onNoMatch` actions and as such, it should have priority.\n     */\n    public func onNoMatch(do action: @escaping ErrorAction) -> ErrorHandler {\n        onNoMatch.append(action)\n        return self\n    }\n    \n    /**\n     Adds an action to be executed whether there is a match for the error or not. This action will be called after potential matching actions have been called.\n     - Parameters:\n         - action: The closure that will be executed if there is no match. The action returns a `MatchingPolicy` instance. If the action is called and returns `MatchingPolicy.continueMatching`, the error handle continues to execute the previously added `always` actions. If the action is called and returns `MatchingPolicy.stopMatching` no other `always` action is executed. This way you can override previously defined `always` actions.\n         - Returns: The updated error handler (self).\n     - Note: You can add multiple `always` actions and they will be executed in lifo order until one of them returns `MatchingPolicy.stopMatching`.\n     */\n    public func always(do action: @escaping ErrorAction) -> ErrorHandler {\n        alwaysActions.append(action)\n        return self\n    }\n    \n    /**\n     Looks for actions that match the error (added with `on(matches:do:)`) and executes them. If there are no matching actions, `onNoMatch` actions will be executed. In any case, `always` actions will also be executed.\n     - Parameter error: The error to handle.\n     */\n    public func handle(_ error: Error) {\n        \n        defer {\n            for alwaysAction in alwaysActions.reversed() {\n                let alwaysMatchingPolicy = alwaysAction(error)\n                if case .stopMatching = alwaysMatchingPolicy {\n                    break\n                }\n            }\n        }\n        \n        var foundMatch = false\n        for (matcher, action) in errorActions.reversed() {\n            if matcher.matches(error) {\n                foundMatch = true\n                let policy = action(error)\n                if case .stopMatching = policy {\n                    return\n                }\n            }\n        }\n        \n        if foundMatch { return }\n        \n        for otherwise in onNoMatch.reversed() {\n            let policy = otherwise(error)\n            if case .stopMatching = policy {\n                break\n            }\n        }\n    }\n    \n    /**\n     Adds a tag (of type `String`) to a specific `matches` closure. After this you can use `on(tag:do:)` to link actions to all the `matches` closures that have been assigned this tag. This way you can group many `matches` closures together, refer to them by a memorizeable tag and handle the errors that match any of them by calling the same action.\n     \n     For example you can tag with \"NetworkError\" all the `matches` closures that match an error related to the network and handle such errors the same way.\n     \n     ````\n     ErrorHandler()\n     .tag(matches: {...}, with: \"NetworkError\")\n     .tag(matches: {...}, with: \"NetworkError\")\n     .on(tag: \"NetworkError\", do: {...})\n     ````\n     An alternative would be to create a new `matcher` or matches function that matches if all the other `matchers` match and use this.\n\n     - Parameters:\n         - matches: the closure that will be given a tag.\n         - tag: A `String` with which the `matches` closure (and any other tagged the same way) can referred with in the `on(tag:do:)` method.\n     - Returns: The updated error handler (self).\n     */\n    public func tag(matches: @escaping ((Error) -> Bool), with tag: Tag) -> ErrorHandler {\n        let matcher = ClosureErrorMatcher(matches: matches)\n        return self.tag(matcher, with: tag)\n    }\n    \n    /**\n     Adds a tag (of type `String`) to a specific `matcher`. After this you can use `on(tag:do:)` to link actions to all the `matchers` that have been assigned this tag. This way you can group many `matchers` closures together, refer to them by a memorizeable tag and handle the errors that match any of them by calling the same action.\n     \n     For example you can tag with \"NetworkError\" all the `matchers` that match an error related to the network and handle such errors the same way.\n     \n     ````\n     ErrorHandler()\n     .tag(connectionFailedMatcher, with: \"NetworkError\")\n     .tag(timeoutErrorMatcher, with: \"NetworkError\")\n     .on(tag: \"NetworkError\", do: {...})\n     ````\n     An alternative would be to create a new `matcher` or matches function that matches if all the other `matchers` match and use this.\n\n     - Parameters:\n         - matcher: The closure that will be given a tag.\n         - tag: A `String` with which the `matches` closure (and any other tagged the same way) can referred with in the `on(tag:do:)` method.\n     - Returns: The updated error handler (self).\n     */\n    public func tag(_ matcher: ErrorMatcher, with tag: Tag) -> ErrorHandler {\n        if tagsDictionary[tag] != nil {\n            tagsDictionary[tag]?.append(matcher)\n        } else {\n            tagsDictionary[tag] = [matcher]\n        }\n        return self\n    }\n    \n    /**\n     Adds an action to all the `matches` closures that have been assigned this tag. This way you can group many `matches` closures together, refer to them by a memorizeable tag and handle the errors that match any of them by calling the same action.\n     - Returns: The updated error handler (self).\n     */\n    public func on(tag: Tag, do action: @escaping ErrorAction) -> ErrorHandler {\n        guard let taggedMatchers = tagsDictionary[tag] else { return self }\n        let matherActionsPairs = taggedMatchers.map({ ($0, action) })\n        errorActions.append(contentsOf: matherActionsPairs)\n        return self\n    }\n    \n    /**\n     Defines an action to be executed if the error is any error of the given type `T`. In essence it is just a convenience method for calling `on(_:do:)` with a matcher that checks the type of the error.\n     \n     - Parameters:\n         - type: The type the error must be in order for the `action` to be called.\n         - action: The closure that will be executed if the error is of type `T`.\n     - Returns: The updated error handler (self).\n     */\n    public func onError<T: Error>(ofType type: T.Type, do action: @escaping ErrorAction) -> ErrorHandler {\n        return on(ErrorTypeMatcher<T>(), do: action)\n    }\n    \n    /**\n     Defines an action to be executed if the error handled by the error handler is equal to the given `Equatable` error.\n     \n     - Parameters:\n     - error: An `Equatable` `Error` we want to handle with the `action` closure.\n     - action: The closure that will be called if the error being handled is equal to the given error (1st parameter).\n     - Returns: The updated error handler (self).\n     */\n    public func on<E: Error & Equatable>(_ error: E, do action: @escaping ErrorAction) -> ErrorHandler {\n        return self.on(\n            matches: { (handledError) -> Bool in\n                guard let handledError = handledError as? E else { return false }\n                return handledError == error\n        }, do: action)\n    }\n    \n    public func onNSError(domain: String, code: Int? = nil, do action: @escaping ErrorAction) -> ErrorHandler {\n        return self.on(NSErrorMatcher(domain: domain, code: code), do: action)\n    }\n}\n\npublic func tryWith(_ handler: ErrorHandler, closure: () throws -> Void) {\n    do {\n        try closure()\n    } catch {\n        handler.handle(error)\n    }\n}\n\n\n"
  },
  {
    "path": "ErrorHandler/Classes/Core/Matchers.swift",
    "content": "//\n//  ErrorMatcher.swift\n//  workable\n//\n//  Created by Kostas Kremizas on 09/05/16.\n//  Copyright © 2016 Workable. All rights reserved.\n//\n\nimport Foundation\n\n/**\n An `ErrorMatcher` is an alternative to using `matches` closures when adding `ErrorActions` to an `ErrorHandler`. An `ErrorMatcher` is considered to match an error when it's `matches` function returns `true` for this error. `ErrorMatcher`s are used to match errors with the `ErrorHandler`'s `on(_ matcher: ErrorMatcher, do action: @escaping ErrorAction)` method.\n\n `ErrorMatcher`s can be combined using || and && operators.\n For example:\n\n ```\n let notConnectedMatcher = NSErrorMatcher(domain: NSURLErrorDomain, code: NSURLErrorNotConnectedToInternet)\n\n let connectionLostMatcher = NSErrorMatcher(domain:   NSURLErrorDomain, code: NSURLErrorNetworkConnectionLost)\n\n let offlineMatcher = notConnectedMatcher || connectionLostMatcher\n ```\n Error matchers have the additional benefit compared to `matches` closures that they describe matching logic in a way that can be more naturally reused. i.e. it is more natural in `Swift` to reuse Types than free functions and closures as the unit of composition in Swift is the type.\n */\npublic protocol ErrorMatcher {\n\n    /**\n     The `ErrorMatcher` is considered to match the error if this function returns true.\n     - Returns: `true` if the matcher matches the `error` otherwise `false`\n     */\n    func matches(_ error: Error) -> Bool\n}\n\n/**\n A generic `ErrorMatcher` over type `E` that `matches` an error if the error `is` `T`\n */\npublic class ErrorTypeMatcher<E: Error>: ErrorMatcher {\n    public init() {}\n    public func matches(_ error: Error) -> Bool {\n        return error is E\n    }\n}\n\n/**\n An `ErrorMatcher` that wraps a `matches` closure\n */\npublic class ClosureErrorMatcher: ErrorMatcher {\n    private let matches: (Error) -> Bool\n\n    public init(matches: @escaping (Error) -> Bool) {\n        self.matches = matches\n    }\n\n    public func matches(_ error: Error) -> Bool {\n        return self.matches(error)\n    }\n}\n\npublic func && (lhs: ErrorMatcher, rhs: ErrorMatcher) -> ErrorMatcher {\n    return ClosureErrorMatcher(matches: { (error) -> Bool in\n        return lhs.matches(error) && rhs.matches(error)\n    })\n}\n\npublic func || (lhs: ErrorMatcher, rhs: ErrorMatcher) -> ErrorMatcher {\n    return ClosureErrorMatcher(matches: { (error) -> Bool in\n        return lhs.matches(error) || rhs.matches(error)\n    })\n}\n\n"
  },
  {
    "path": "ErrorHandler/Classes/Core/NSErrorMatcher.swift",
    "content": "//\n//  NSURLErrorMatcher.swift\n//  ErrorHandler-iOS\n//\n//  Created by Eleni Papanikolopoulou on 02/08/2017.\n//  Copyright © 2017 Workable. All rights reserved.\n//\n\nimport Foundation\n\npublic struct NSErrorMatcher: ErrorMatcher {\n    \n    let domain: String\n    var code: Int?\n\n    public func matches(_ error: Error) -> Bool {\n        let nsError = error as NSError\n        \n        guard nsError.domain == domain else { return false }\n        \n        if let code = code {\n            return code == nsError.code\n        }\n        \n        return true\n    }\n\n    public init(domain: String, code: Int?){\n        self.domain =  domain\n        self.code = code\n    }\n}\n"
  },
  {
    "path": "ErrorHandler.podspec",
    "content": "Pod::Spec.new do |s|\n  s.name         = \"ErrorHandler\"\n  s.version      = \"0.8.4\"\n  s.swift_versions = ['4.2', '5.0']\n  s.summary      = \"Elegant and flexible error handling for Swift\"\n  s.description  = <<-DESC\n  > Elegant and flexible error handling for Swift\n\nErrorHandler enables expressing complex error handling logic with a few lines of code using a memorable fluent API.\n  DESC\n  s.homepage     = \"https://github.com/Workable/swift-error-handler\"\n  s.license      = { :type => \"MIT\", :file => \"LICENSE\" }\n  s.authors             = { \"Kostas Kremizas\" => \"kremizask@gmail.com\",\n                            \"Eleni Papanikolopoulou\" => \"eleni.papanikolopoulou@gmail.com\" }\n  s.ios.deployment_target = '10.0'\n  s.osx.deployment_target = '10.12'\n  s.tvos.deployment_target = '10.0'\n  s.watchos.deployment_target = '3.0'\n  s.source       = { :git => \"https://github.com/Workable/swift-error-handler.git\", :tag => s.version.to_s }\n\n  s.default_subspec = \"Core\"\n\n  s.subspec \"Core\" do |ss|\n    ss.source_files  = \"ErrorHandler/Classes/Core/**/*\"\n    ss.framework  = \"Foundation\"\n  end\n\n  s.subspec \"Alamofire\" do |ss|\n    ss.source_files = \"ErrorHandler/Classes/Alamofire/**/*\"\n    ss.dependency \"Alamofire\", \"~> 5\"\n    ss.dependency \"ErrorHandler/Core\"\n  end\nend\n"
  },
  {
    "path": "Example/ErrorHandler/AFError+Extensions.swift",
    "content": "//\n//  AFError+Extensions.swift\n//  ErrorHandler_Example\n//\n//  Created by Kostas Kremizas on 01/09/2017.\n//  Copyright © 2017 CocoaPods. All rights reserved.\n//\n\nimport Foundation\nimport Alamofire\n\nextension AFError {\n    init(statusCode: Int) {\n        self = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: statusCode))\n    }\n}\n"
  },
  {
    "path": "Example/ErrorHandler/AlertManager.swift",
    "content": "//\n//  AlertManager.swift\n//  Example-iOS\n//\n//  Created by Eleni Papanikolopoulou on 05/08/2017.\n//  Copyright © 2017 Workable. All rights reserved.\n//\n\nimport UIKit\n\nextension UIApplication {\n    class func topVC() -> UIViewController {\n        // cheating, I know\n        // Normally if you want the handler to have state you should subclass it.\n        return UIApplication.shared.keyWindow!.rootViewController!\n    }\n}\n\nextension UIAlertController {\n    func show() {\n        DispatchQueue.main.async {\n            UIApplication.topVC().present(self, animated: true, completion: nil)\n        }\n    }\n}\n\nclass AlertManager {\n    class func showAlert(title: String = \"\", message: String = \"\") {\n        let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)\n        let defaultAction = UIAlertAction(title: \"OK\", style: .default, handler: nil)\n        alert.addAction(defaultAction)\n        alert.show()\n    }\n}\n"
  },
  {
    "path": "Example/ErrorHandler/AppDelegate.swift",
    "content": "//\n//  AppDelegate.swift\n//  Example-iOS\n//\n//  Created by Kostas Kremizas on 24/07/2017.\n//  Copyright © 2017 Workable. All rights reserved.\n//\n\nimport UIKit\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    var window: UIWindow?\n\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {\n        // Override point for customization after application launch.\n        return true\n    }\n\n    func applicationWillResignActive(_ application: UIApplication) {\n        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.\n        // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.\n    }\n\n    func applicationDidEnterBackground(_ application: UIApplication) {\n        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.\n        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.\n    }\n\n    func applicationWillEnterForeground(_ application: UIApplication) {\n        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.\n    }\n\n    func applicationDidBecomeActive(_ application: UIApplication) {\n        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.\n    }\n\n    func applicationWillTerminate(_ application: UIApplication) {\n        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.\n    }\n\n\n}\n\n"
  },
  {
    "path": "Example/ErrorHandler/Base.lproj/LaunchScreen.xib",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" version=\"3.0\" toolsVersion=\"13168.3\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" useTraitCollections=\"YES\" colorMatched=\"YES\">\n    <device id=\"retina4_7\" orientation=\"portrait\">\n        <adaptation id=\"fullscreen\"/>\n    </device>\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"13147.4\"/>\n        <capability name=\"Constraints with non-1.0 multipliers\" minToolsVersion=\"5.1\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <objects>\n        <placeholder placeholderIdentifier=\"IBFilesOwner\" id=\"-1\" userLabel=\"File's Owner\"/>\n        <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"-2\" customClass=\"UIResponder\"/>\n        <view contentMode=\"scaleToFill\" id=\"iN0-l3-epB\">\n            <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"480\" height=\"480\"/>\n            <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n            <subviews>\n                <label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"  Copyright (c) 2017 Workable. All rights reserved.\" textAlignment=\"center\" lineBreakMode=\"tailTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"9\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"8ie-xW-0ye\">\n                    <rect key=\"frame\" x=\"20\" y=\"439\" width=\"441\" height=\"21\"/>\n                    <fontDescription key=\"fontDescription\" type=\"system\" pointSize=\"17\"/>\n                    <color key=\"textColor\" cocoaTouchSystemColor=\"darkTextColor\"/>\n                    <nil key=\"highlightedColor\"/>\n                </label>\n                <label opaque=\"NO\" clipsSubviews=\"YES\" userInteractionEnabled=\"NO\" contentMode=\"left\" horizontalHuggingPriority=\"251\" verticalHuggingPriority=\"251\" text=\"ErrorHandler\" textAlignment=\"center\" lineBreakMode=\"middleTruncation\" baselineAdjustment=\"alignBaselines\" minimumFontSize=\"18\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"kId-c2-rCX\">\n                    <rect key=\"frame\" x=\"20\" y=\"140\" width=\"441\" height=\"43\"/>\n                    <fontDescription key=\"fontDescription\" type=\"boldSystem\" pointSize=\"36\"/>\n                    <color key=\"textColor\" cocoaTouchSystemColor=\"darkTextColor\"/>\n                    <nil key=\"highlightedColor\"/>\n                </label>\n            </subviews>\n            <color key=\"backgroundColor\" red=\"1\" green=\"1\" blue=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n            <constraints>\n                <constraint firstItem=\"kId-c2-rCX\" firstAttribute=\"centerY\" secondItem=\"iN0-l3-epB\" secondAttribute=\"bottom\" multiplier=\"1/3\" constant=\"1\" id=\"5cJ-9S-tgC\"/>\n                <constraint firstAttribute=\"centerX\" secondItem=\"kId-c2-rCX\" secondAttribute=\"centerX\" id=\"Koa-jz-hwk\"/>\n                <constraint firstAttribute=\"bottom\" secondItem=\"8ie-xW-0ye\" secondAttribute=\"bottom\" constant=\"20\" id=\"Kzo-t9-V3l\"/>\n                <constraint firstItem=\"8ie-xW-0ye\" firstAttribute=\"leading\" secondItem=\"iN0-l3-epB\" secondAttribute=\"leading\" constant=\"20\" symbolic=\"YES\" id=\"MfP-vx-nX0\"/>\n                <constraint firstAttribute=\"centerX\" secondItem=\"8ie-xW-0ye\" secondAttribute=\"centerX\" id=\"ZEH-qu-HZ9\"/>\n                <constraint firstItem=\"kId-c2-rCX\" firstAttribute=\"leading\" secondItem=\"iN0-l3-epB\" secondAttribute=\"leading\" constant=\"20\" symbolic=\"YES\" id=\"fvb-Df-36g\"/>\n            </constraints>\n            <nil key=\"simulatedStatusBarMetrics\"/>\n            <freeformSimulatedSizeMetrics key=\"simulatedDestinationMetrics\"/>\n            <point key=\"canvasLocation\" x=\"548\" y=\"455\"/>\n        </view>\n    </objects>\n</document>\n"
  },
  {
    "path": "Example/ErrorHandler/Base.lproj/Main.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"13168.3\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" useTraitCollections=\"YES\" colorMatched=\"YES\" initialViewController=\"l2r-e6-VrS\">\n    <device id=\"retina4_7\" orientation=\"portrait\">\n        <adaptation id=\"fullscreen\"/>\n    </device>\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"13147.4\"/>\n        <capability name=\"documents saved in the Xcode 8 format\" minToolsVersion=\"8.0\"/>\n    </dependencies>\n    <scenes>\n        <!--Errors-->\n        <scene sceneID=\"Qcb-F1-nBM\">\n            <objects>\n                <tableViewController title=\"Errors\" id=\"GPW-6f-FLY\" customClass=\"ErrorHandlingTableViewController\" customModule=\"Example_iOS\" customModuleProvider=\"target\" sceneMemberID=\"viewController\">\n                    <tableView key=\"view\" clipsSubviews=\"YES\" contentMode=\"scaleToFill\" alwaysBounceVertical=\"YES\" dataMode=\"prototypes\" style=\"plain\" separatorStyle=\"default\" rowHeight=\"-1\" estimatedRowHeight=\"-1\" sectionHeaderHeight=\"28\" sectionFooterHeight=\"28\" id=\"Ady-7q-puc\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"667\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"calibratedWhite\"/>\n                        <prototypes>\n                            <tableViewCell clipsSubviews=\"YES\" contentMode=\"scaleToFill\" selectionStyle=\"default\" indentationWidth=\"10\" reuseIdentifier=\"errorCell\" id=\"0tm-aR-ErT\">\n                                <rect key=\"frame\" x=\"0.0\" y=\"28\" width=\"375\" height=\"44\"/>\n                                <autoresizingMask key=\"autoresizingMask\"/>\n                                <tableViewCellContentView key=\"contentView\" opaque=\"NO\" clipsSubviews=\"YES\" multipleTouchEnabled=\"YES\" contentMode=\"center\" insetsLayoutMarginsFromSafeArea=\"NO\" tableViewCell=\"0tm-aR-ErT\" id=\"AQQ-nv-JRU\">\n                                    <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"43.5\"/>\n                                    <autoresizingMask key=\"autoresizingMask\"/>\n                                </tableViewCellContentView>\n                            </tableViewCell>\n                        </prototypes>\n                        <connections>\n                            <outlet property=\"dataSource\" destination=\"GPW-6f-FLY\" id=\"nDV-NV-Fjz\"/>\n                            <outlet property=\"delegate\" destination=\"GPW-6f-FLY\" id=\"eNM-kT-Byn\"/>\n                        </connections>\n                    </tableView>\n                    <navigationItem key=\"navigationItem\" title=\"Errors\" id=\"tmK-kS-iVM\"/>\n                </tableViewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"CdB-0a-Z6e\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"28\" y=\"70.614692653673174\"/>\n        </scene>\n        <!--Navigation Controller-->\n        <scene sceneID=\"gbU-Ti-1vi\">\n            <objects>\n                <navigationController automaticallyAdjustsScrollViewInsets=\"NO\" id=\"l2r-e6-VrS\" sceneMemberID=\"viewController\">\n                    <toolbarItems/>\n                    <navigationBar key=\"navigationBar\" contentMode=\"scaleToFill\" insetsLayoutMarginsFromSafeArea=\"NO\" id=\"2QY-im-Hpe\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"375\" height=\"44\"/>\n                        <autoresizingMask key=\"autoresizingMask\"/>\n                    </navigationBar>\n                    <nil name=\"viewControllers\"/>\n                    <connections>\n                        <segue destination=\"GPW-6f-FLY\" kind=\"relationship\" relationship=\"rootViewController\" id=\"RSJ-b8-LA3\"/>\n                    </connections>\n                </navigationController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"Ezf-Mq-8sc\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"-711\" y=\"71\"/>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "Example/ErrorHandler/DefaultErrorHandler.swift",
    "content": "//\n//  DefaultErrorHandler.swift\n//  Example-iOS\n//\n//  Created by Eleni Papanikolopoulou on 05/08/2017.\n//  Copyright © 2017 Workable. All rights reserved.\n//\n\nimport UIKit\nimport ErrorHandler\n\nprotocol LoggableError: Error {\n    var loggableDescripiton: String { get }\n}\n\nenum CustomError: Error, LoggableError {\n    case unknown\n    case parsingError\n    \n    var loggableDescripiton: String {\n        return String(describing: self)\n    }\n}\n\nextension ErrorHandler {\n    static var `default` : ErrorHandler {\n        \n        return ErrorHandler()\n            .onAFError(withStatus: 400..<451, do: { (error) -> MatchingPolicy in\n                AlertManager.showAlert(title: \"Client error\")\n                return .continueMatching\n            })\n            .onAFError(withStatus: 500..<512, do: { (_) -> MatchingPolicy in\n                AlertManager.showAlert(title: \"Server Error\")\n                return .continueMatching\n            })\n            .onAFError(withStatus: 401, do: { (error) -> MatchingPolicy in\n                AlertManager.showAlert(title: \"Unauthorized errror\", message: \"You are not authorized for this action.\")\n                return .stopMatching\n            })\n            .onNSError(domain: NSURLErrorDomain, code: NSURLErrorNotConnectedToInternet, do: { (error) -> MatchingPolicy in\n                AlertManager.showAlert(title: \"You seem to be offline\", message: \"Check your connection and try again.\")\n                return .continueMatching\n            })\n            .on(CustomError.parsingError, do: { (error) -> MatchingPolicy in\n                AlertManager.showAlert(title: \"Parsing Error\")\n                return .continueMatching\n            })\n            .tag(AFErrorStatusCodeMatcher(400..<512), with: \"http\")\n            .onNoMatch(do: { (error) -> MatchingPolicy in\n                AlertManager.showAlert(title: \"Unknown error\", message: \"Oops.. Something went wrong.\")\n                return .continueMatching\n            })\n            .always(do: { (error) -> MatchingPolicy in\n                print((error as? LoggableError)?.loggableDescripiton ?? error.localizedDescription)\n                return .continueMatching\n            })\n    }\n}\n"
  },
  {
    "path": "Example/ErrorHandler/ErrorHandlingTableViewController.swift",
    "content": "//\n//  ErrorHandlingTableViewController.swift\n//  Example-iOS\n//\n//  Created by Eleni Papanikolopoulou on 05/08/2017.\n//  Copyright © 2017 Workable. All rights reserved.\n//\n\nimport UIKit\nimport ErrorHandler\nimport Alamofire\n\nclass ErrorHandlingTableViewController: UITableViewController {\n    \n    private let errorsAndTitles: [(Error, String)] = [\n        (AFError(statusCode: 401), \"401 Unauthorized error\"),\n        (NSError(domain: NSURLErrorDomain, code: NSURLErrorNotConnectedToInternet, userInfo: [NSLocalizedDescriptionKey: \"Not connected to the internet\"]) , \"Offline Error\"),\n        (AFError(statusCode: 400), \"400 (4xx client errors)\"),\n        (AFError(statusCode: 402), \"401 (4xx client errors)\"),\n        (AFError(statusCode: 500), \"500\"),\n        (CustomError.parsingError, \"Parsing error\")\n    ]\n    \n    override func viewDidLoad() {\n        super.viewDidLoad()\n    }\n\n    // MARK: - Table view data source\n\n    override func numberOfSections(in tableView: UITableView) -> Int {\n        return 1\n    }\n\n    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {\n        return errorsAndTitles.count\n    }\n\n    override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {\n        let cell = tableView.dequeueReusableCell(withIdentifier: \"errorCell\", for: indexPath)\n        cell.textLabel?.text = errorsAndTitles[indexPath.row].1\n        cell.selectionStyle = .none\n        return cell\n    }\n\n    override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {\n        \n        let error: Error = errorsAndTitles[indexPath.row].0\n        \n        switch indexPath.row {\n        case 3:\n            // Lets say thatin this case as a single exception in our app we want to provide for 401 errors\n            //  the more generic error message about 4xx errors\n            ErrorHandler.default\n                .onAFError(withStatus: 401, do: { (error) -> MatchingPolicy in\n                    return .continueMatching\n                })\n                .handle(error)\n        case 4:\n            // Let's say that in this case we also want to do some additional action if it is any invalid http status error\n            ErrorHandler.default\n                .on(tag: \"http\", do: { (_) -> MatchingPolicy in\n                    print(\"Oh dear! They tapped on the 5th row and also got an invalid http status!\")\n                    return .continueMatching\n                })\n                .handle(error)\n        default:\n            ErrorHandler.default\n                .handle(error)\n        }\n    }\n}\n"
  },
  {
    "path": "Example/ErrorHandler/Images.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"29x29\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"40x40\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"iphone\",\n      \"size\" : \"60x60\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "Example/ErrorHandler/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIMainStoryboardFile</key>\n\t<string>Main</string>\n\t<key>UIRequiredDeviceCapabilities</key>\n\t<array>\n\t\t<string>armv7</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t</array>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/ErrorHandler/ViewController.swift",
    "content": "//\n//  ViewController.swift\n//  ErrorHandler\n//\n//  Created by kremizask on 09/01/2017.\n//  Copyright (c) 2017 kremizask. All rights reserved.\n//\n\nimport UIKit\n\nclass ViewController: UIViewController {\n\n    override func viewDidLoad() {\n        super.viewDidLoad()\n        // Do any additional setup after loading the view, typically from a nib.\n    }\n\n    override func didReceiveMemoryWarning() {\n        super.didReceiveMemoryWarning()\n        // Dispose of any resources that can be recreated.\n    }\n\n}\n\n"
  },
  {
    "path": "Example/ErrorHandler.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:ErrorHandler.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:Pods/Pods.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "Example/ErrorHandler.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Podfile",
    "content": "platform :ios, '10.0'\nsource 'https://github.com/Workable/PodSpecs.git'\nsource 'https://github.com/CocoaPods/Specs.git'\nuse_frameworks!\n\ntarget 'ErrorHandler_Example' do\n\n  pod 'ErrorHandler', :path => \"../\"\n  pod 'ErrorHandler/Alamofire', :path => \"../\"\n\n  target 'ErrorHandler_Tests' do\n    inherit! :search_paths\n  end\nend\n"
  },
  {
    "path": "Example/Pods/Alamofire/LICENSE",
    "content": "Copyright (c) 2014-2020 Alamofire Software Foundation (http://alamofire.org/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "Example/Pods/Alamofire/README.md",
    "content": "![Alamofire: Elegant Networking in Swift](https://raw.githubusercontent.com/Alamofire/Alamofire/master/alamofire.png)\n\n[![Build Status](https://github.com/Alamofire/Alamofire/workflows/Alamofire%20CI/badge.svg?branch=master)](https://github.com/Alamofire/Alamofire/actions)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Alamofire.svg)](https://img.shields.io/cocoapods/v/Alamofire.svg)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n[![Platform](https://img.shields.io/cocoapods/p/Alamofire.svg?style=flat)](https://alamofire.github.io/Alamofire)\n[![Twitter](https://img.shields.io/badge/twitter-@AlamofireSF-blue.svg?style=flat)](https://twitter.com/AlamofireSF)\n[![Gitter](https://badges.gitter.im/Alamofire/Alamofire.svg)](https://gitter.im/Alamofire/Alamofire?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)\n[![Open Source Helpers](https://www.codetriage.com/alamofire/alamofire/badges/users.svg)](https://www.codetriage.com/alamofire/alamofire)\n\nAlamofire is an HTTP networking library written in Swift.\n\n- [Features](#features)\n- [Component Libraries](#component-libraries)\n- [Requirements](#requirements)\n- [Migration Guides](#migration-guides)\n- [Communication](#communication)\n- [Installation](#installation)\n- [Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#using-alamofire)\n    - [**Introduction -**](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#introduction) [Making Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#making-requests), [Response Handling](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-handling), [Response Validation](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-validation), [Response Caching](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-caching)\n\t- **HTTP -** [HTTP Methods](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-methods), [Parameters and Parameter Encoder](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md##request-parameters-and-parameter-encoders), [HTTP Headers](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#http-headers), [Authentication](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#authentication)\n\t- **Large Data -** [Downloading Data to a File](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#downloading-data-to-a-file), [Uploading Data to a Server](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#uploading-data-to-a-server)\n\t- **Tools -** [Statistical Metrics](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#statistical-metrics), [cURL Command Output](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#curl-command-output)\n- [Advanced Usage](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md)\n\t- **URL Session -** [Session Manager](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#session), [Session Delegate](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#sessiondelegate), [Request](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#request)\n\t- **Routing -** [Routing Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#routing-requests), [Adapting and Retrying Requests](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#adapting-and-retrying-requests)\n\t- **Model Objects -** [Custom Response Serialization](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#custom-response-serialization)\n\t- **Connection -** [Security](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#security), [Network Reachability](https://github.com/Alamofire/Alamofire/blob/master/Documentation/AdvancedUsage.md#network-reachability)\n- [Open Radars](#open-radars)\n- [FAQ](#faq)\n- [Credits](#credits)\n- [Donations](#donations)\n- [License](#license)\n\n## Features\n\n- [x] Chainable Request / Response Methods\n- [x] URL / JSON Parameter Encoding\n- [x] Upload File / Data / Stream / MultipartFormData\n- [x] Download File using Request or Resume Data\n- [x] Authentication with URLCredential\n- [x] HTTP Response Validation\n- [x] Upload and Download Progress Closures with Progress\n- [x] cURL Command Output\n- [x] Dynamically Adapt and Retry Requests\n- [x] TLS Certificate and Public Key Pinning\n- [x] Network Reachability\n- [x] Comprehensive Unit and Integration Test Coverage\n- [x] [Complete Documentation](https://alamofire.github.io/Alamofire)\n\n## Component Libraries\n\nIn order to keep Alamofire focused specifically on core networking implementations, additional component libraries have been created by the [Alamofire Software Foundation](https://github.com/Alamofire/Foundation) to bring additional functionality to the Alamofire ecosystem.\n\n- [AlamofireImage](https://github.com/Alamofire/AlamofireImage) - An image library including image response serializers, `UIImage` and `UIImageView` extensions, custom image filters, an auto-purging in-memory cache and a priority-based image downloading system.\n- [AlamofireNetworkActivityIndicator](https://github.com/Alamofire/AlamofireNetworkActivityIndicator) - Controls the visibility of the network activity indicator on iOS using Alamofire. It contains configurable delay timers to help mitigate flicker and can support `URLSession` instances not managed by Alamofire.\n\n## Requirements\n\n- iOS 10.0+ / macOS 10.12+ / tvOS 10.0+ / watchOS 3.0+\n- Xcode 10.2+\n- Swift 5+\n\n## Migration Guides\n\n- [Alamofire 5.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%205.0%20Migration%20Guide.md)\n- [Alamofire 4.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%204.0%20Migration%20Guide.md)\n- [Alamofire 3.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%203.0%20Migration%20Guide.md)\n- [Alamofire 2.0 Migration Guide](https://github.com/Alamofire/Alamofire/blob/master/Documentation/Alamofire%202.0%20Migration%20Guide.md)\n\n## Communication\n- If you **need help with making network requests** using Alamofire, use [Stack Overflow](https://stackoverflow.com/questions/tagged/alamofire) and tag `alamofire`.\n- If you need to **find or understand an API**, check [our documentation](http://alamofire.github.io/Alamofire/) or [Apple's documentation for `URLSession`](https://developer.apple.com/documentation/foundation/url_loading_system), on top of which Alamofire is built.\n- If you need **help with an Alamofire feature**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire).\n- If you'd like to **discuss Alamofire best practices**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire).\n- If you'd like to **discuss a feature request**, use [our forum on swift.org](https://forums.swift.org/c/related-projects/alamofire). \n- If you **found a bug**, open an issue here on GitHub and follow the guide. The more detail the better!\n- If you **want to contribute**, submit a pull request!\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'Alamofire', '~> 5.0'\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate Alamofire into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"Alamofire/Alamofire\" \"5.0\"\n```\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler. It is in early development, but Alamofire does support its use on supported platforms.\n\nOnce you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/Alamofire/Alamofire.git\", from: \"5.0\")\n]\n```\n\n### Manually\n\nIf you prefer not to use any of the aforementioned dependency managers, you can integrate Alamofire into your project manually.\n\n#### Embedded Framework\n\n- Open up Terminal, `cd` into your top-level project directory, and run the following command \"if\" your project is not initialized as a git repository:\n\n  ```bash\n  $ git init\n  ```\n\n- Add Alamofire as a git [submodule](https://git-scm.com/docs/git-submodule) by running the following command:\n\n  ```bash\n  $ git submodule add https://github.com/Alamofire/Alamofire.git\n  ```\n\n- Open the new `Alamofire` folder, and drag the `Alamofire.xcodeproj` into the Project Navigator of your application's Xcode project.\n\n    > It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.\n\n- Select the `Alamofire.xcodeproj` in the Project Navigator and verify the deployment target matches that of your application target.\n- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the \"Targets\" heading in the sidebar.\n- In the tab bar at the top of that window, open the \"General\" panel.\n- Click on the `+` button under the \"Embedded Binaries\" section.\n- You will see two different `Alamofire.xcodeproj` folders each with two different versions of the `Alamofire.framework` nested inside a `Products` folder.\n\n    > It does not matter which `Products` folder you choose from, but it does matter whether you choose the top or bottom `Alamofire.framework`.\n\n- Select the top `Alamofire.framework` for iOS and the bottom one for macOS.\n\n    > You can verify which one you selected by inspecting the build log for your project. The build target for `Alamofire` will be listed as either `Alamofire iOS`, `Alamofire macOS`, `Alamofire tvOS` or `Alamofire watchOS`.\n\n- And that's it!\n\n  > The `Alamofire.framework` is automagically added as a target dependency, linked framework and embedded framework in a copy files build phase which is all you need to build on the simulator and a device.\n\n## Open Radars\n\nThe following radars have some effect on the current implementation of Alamofire.\n\n- [`rdar://21349340`](http://www.openradar.me/radar?id=5517037090635776) - Compiler throwing warning due to toll-free bridging issue in test case\n- `rdar://26870455` - Background URL Session Configurations do not work in the simulator\n- `rdar://26849668` - Some URLProtocol APIs do not properly handle `URLRequest`\n\n## Resolved Radars\n\nThe following radars have been resolved over time after being filed against the Alamofire project.\n\n- [`rdar://26761490`](http://www.openradar.me/radar?id=5010235949318144) - Swift string interpolation causing memory leak with common usage.\n  - (Resolved): 9/1/17 in Xcode 9 beta 6.\n- [`rdar://36082113`](http://openradar.appspot.com/radar?id=4942308441063424) - `URLSessionTaskMetrics` failing to link on watchOS 3.0+\n  - (Resolved): Just add `CFNetwork` to your linked frameworks.\n  \n## FAQ\n\n### What's the origin of the name Alamofire?\n\nAlamofire is named after the [Alamo Fire flower](https://aggie-horticulture.tamu.edu/wildseed/alamofire.html), a hybrid variant of the Bluebonnet, the official state flower of Texas.\n\n## Credits\n\nAlamofire is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org). You can follow them on Twitter at [@AlamofireSF](https://twitter.com/AlamofireSF) for project updates and releases.\n\n### Security Disclosure\n\nIf you believe you have identified a security vulnerability with Alamofire, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker.\n\n## Donations\n\nThe [ASF](https://github.com/Alamofire/Foundation#members) is looking to raise money to officially stay registered as a federal non-profit organization.\nRegistering will allow us members to gain some legal protections and also allow us to put donations to use, tax-free.\nDonating to the ASF will enable us to:\n\n- Pay our yearly legal fees to keep the non-profit in good status\n- Pay for our mail servers to help us stay on top of all questions and security issues\n- Potentially fund test servers to make it easier for us to test the edge cases\n- Potentially fund developers to work on one of our projects full-time\n\nThe community adoption of the ASF libraries has been amazing.\nWe are greatly humbled by your enthusiasm around the projects and want to continue to do everything we can to move the needle forward.\nWith your continued support, the ASF will be able to improve its reach and also provide better legal safety for the core members.\nIf you use any of our libraries for work, see if your employers would be interested in donating.\nAny amount you can donate today to help us reach our goal would be greatly appreciated.\n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W34WPEE74APJQ)\n\n## License\n\nAlamofire is released under the MIT license. [See LICENSE](https://github.com/Alamofire/Alamofire/blob/master/LICENSE) for details.\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/AFError.swift",
    "content": "//\n//  AFError.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// `AFError` is the error type returned by Alamofire. It encompasses a few different types of errors, each with\n/// their own associated reasons.\npublic enum AFError: Error {\n    /// The underlying reason the `.multipartEncodingFailed` error occurred.\n    public enum MultipartEncodingFailureReason {\n        /// The `fileURL` provided for reading an encodable body part isn't a file `URL`.\n        case bodyPartURLInvalid(url: URL)\n        /// The filename of the `fileURL` provided has either an empty `lastPathComponent` or `pathExtension.\n        case bodyPartFilenameInvalid(in: URL)\n        /// The file at the `fileURL` provided was not reachable.\n        case bodyPartFileNotReachable(at: URL)\n        /// Attempting to check the reachability of the `fileURL` provided threw an error.\n        case bodyPartFileNotReachableWithError(atURL: URL, error: Error)\n        /// The file at the `fileURL` provided is actually a directory.\n        case bodyPartFileIsDirectory(at: URL)\n        /// The size of the file at the `fileURL` provided was not returned by the system.\n        case bodyPartFileSizeNotAvailable(at: URL)\n        /// The attempt to find the size of the file at the `fileURL` provided threw an error.\n        case bodyPartFileSizeQueryFailedWithError(forURL: URL, error: Error)\n        /// An `InputStream` could not be created for the provided `fileURL`.\n        case bodyPartInputStreamCreationFailed(for: URL)\n        /// An `OutputStream` could not be created when attempting to write the encoded data to disk.\n        case outputStreamCreationFailed(for: URL)\n        /// The encoded body data could not be written to disk because a file already exists at the provided `fileURL`.\n        case outputStreamFileAlreadyExists(at: URL)\n        /// The `fileURL` provided for writing the encoded body data to disk is not a file `URL`.\n        case outputStreamURLInvalid(url: URL)\n        /// The attempt to write the encoded body data to disk failed with an underlying error.\n        case outputStreamWriteFailed(error: Error)\n        /// The attempt to read an encoded body part `InputStream` failed with underlying system error.\n        case inputStreamReadFailed(error: Error)\n    }\n\n    /// The underlying reason the `.parameterEncodingFailed` error occurred.\n    public enum ParameterEncodingFailureReason {\n        /// The `URLRequest` did not have a `URL` to encode.\n        case missingURL\n        /// JSON serialization failed with an underlying system error during the encoding process.\n        case jsonEncodingFailed(error: Error)\n        /// Custom parameter encoding failed due to the associated `Error`.\n        case customEncodingFailed(error: Error)\n    }\n\n    /// The underlying reason the `.parameterEncoderFailed` error occurred.\n    public enum ParameterEncoderFailureReason {\n        /// Possible missing components.\n        public enum RequiredComponent {\n            /// The `URL` was missing or unable to be extracted from the passed `URLRequest` or during encoding.\n            case url\n            /// The `HTTPMethod` could not be extracted from the passed `URLRequest`.\n            case httpMethod(rawValue: String)\n        }\n\n        /// A `RequiredComponent` was missing during encoding.\n        case missingRequiredComponent(RequiredComponent)\n        /// The underlying encoder failed with the associated error.\n        case encoderFailed(error: Error)\n    }\n\n    /// The underlying reason the `.responseValidationFailed` error occurred.\n    public enum ResponseValidationFailureReason {\n        /// The data file containing the server response did not exist.\n        case dataFileNil\n        /// The data file containing the server response at the associated `URL` could not be read.\n        case dataFileReadFailed(at: URL)\n        /// The response did not contain a `Content-Type` and the `acceptableContentTypes` provided did not contain a\n        /// wildcard type.\n        case missingContentType(acceptableContentTypes: [String])\n        /// The response `Content-Type` did not match any type in the provided `acceptableContentTypes`.\n        case unacceptableContentType(acceptableContentTypes: [String], responseContentType: String)\n        /// The response status code was not acceptable.\n        case unacceptableStatusCode(code: Int)\n        /// Custom response validation failed due to the associated `Error`.\n        case customValidationFailed(error: Error)\n    }\n\n    /// The underlying reason the response serialization error occurred.\n    public enum ResponseSerializationFailureReason {\n        /// The server response contained no data or the data was zero length.\n        case inputDataNilOrZeroLength\n        /// The file containing the server response did not exist.\n        case inputFileNil\n        /// The file containing the server response could not be read from the associated `URL`.\n        case inputFileReadFailed(at: URL)\n        /// String serialization failed using the provided `String.Encoding`.\n        case stringSerializationFailed(encoding: String.Encoding)\n        /// JSON serialization failed with an underlying system error.\n        case jsonSerializationFailed(error: Error)\n        /// A `DataDecoder` failed to decode the response due to the associated `Error`.\n        case decodingFailed(error: Error)\n        /// A custom response serializer failed due to the associated `Error`.\n        case customSerializationFailed(error: Error)\n        /// Generic serialization failed for an empty response that wasn't type `Empty` but instead the associated type.\n        case invalidEmptyResponse(type: String)\n    }\n\n    /// Underlying reason a server trust evaluation error occurred.\n    public enum ServerTrustFailureReason {\n        /// The output of a server trust evaluation.\n        public struct Output {\n            /// The host for which the evaluation was performed.\n            public let host: String\n            /// The `SecTrust` value which was evaluated.\n            public let trust: SecTrust\n            /// The `OSStatus` of evaluation operation.\n            public let status: OSStatus\n            /// The result of the evaluation operation.\n            public let result: SecTrustResultType\n\n            /// Creates an `Output` value from the provided values.\n            init(_ host: String, _ trust: SecTrust, _ status: OSStatus, _ result: SecTrustResultType) {\n                self.host = host\n                self.trust = trust\n                self.status = status\n                self.result = result\n            }\n        }\n\n        /// No `ServerTrustEvaluator` was found for the associated host.\n        case noRequiredEvaluator(host: String)\n        /// No certificates were found with which to perform the trust evaluation.\n        case noCertificatesFound\n        /// No public keys were found with which to perform the trust evaluation.\n        case noPublicKeysFound\n        /// During evaluation, application of the associated `SecPolicy` failed.\n        case policyApplicationFailed(trust: SecTrust, policy: SecPolicy, status: OSStatus)\n        /// During evaluation, setting the associated anchor certificates failed.\n        case settingAnchorCertificatesFailed(status: OSStatus, certificates: [SecCertificate])\n        /// During evaluation, creation of the revocation policy failed.\n        case revocationPolicyCreationFailed\n        /// `SecTrust` evaluation failed with the associated `Error`, if one was produced.\n        case trustEvaluationFailed(error: Error?)\n        /// Default evaluation failed with the associated `Output`.\n        case defaultEvaluationFailed(output: Output)\n        /// Host validation failed with the associated `Output`.\n        case hostValidationFailed(output: Output)\n        /// Revocation check failed with the associated `Output` and options.\n        case revocationCheckFailed(output: Output, options: RevocationTrustEvaluator.Options)\n        /// Certificate pinning failed.\n        case certificatePinningFailed(host: String, trust: SecTrust, pinnedCertificates: [SecCertificate], serverCertificates: [SecCertificate])\n        /// Public key pinning failed.\n        case publicKeyPinningFailed(host: String, trust: SecTrust, pinnedKeys: [SecKey], serverKeys: [SecKey])\n        /// Custom server trust evaluation failed due to the associated `Error`.\n        case customEvaluationFailed(error: Error)\n    }\n\n    /// The underlying reason the `.urlRequestValidationFailed`\n    public enum URLRequestValidationFailureReason {\n        /// URLRequest with GET method had body data.\n        case bodyDataInGETRequest(Data)\n    }\n\n    ///  `UploadableConvertible` threw an error in `createUploadable()`.\n    case createUploadableFailed(error: Error)\n    ///  `URLRequestConvertible` threw an error in `asURLRequest()`.\n    case createURLRequestFailed(error: Error)\n    /// `SessionDelegate` threw an error while attempting to move downloaded file to destination URL.\n    case downloadedFileMoveFailed(error: Error, source: URL, destination: URL)\n    /// `Request` was explicitly cancelled.\n    case explicitlyCancelled\n    /// `URLConvertible` type failed to create a valid `URL`.\n    case invalidURL(url: URLConvertible)\n    /// Multipart form encoding failed.\n    case multipartEncodingFailed(reason: MultipartEncodingFailureReason)\n    /// `ParameterEncoding` threw an error during the encoding process.\n    case parameterEncodingFailed(reason: ParameterEncodingFailureReason)\n    /// `ParameterEncoder` threw an error while running the encoder.\n    case parameterEncoderFailed(reason: ParameterEncoderFailureReason)\n    /// `RequestAdapter` threw an error during adaptation.\n    case requestAdaptationFailed(error: Error)\n    /// `RequestRetrier` threw an error during the request retry process.\n    case requestRetryFailed(retryError: Error, originalError: Error)\n    /// Response validation failed.\n    case responseValidationFailed(reason: ResponseValidationFailureReason)\n    /// Response serialization failed.\n    case responseSerializationFailed(reason: ResponseSerializationFailureReason)\n    /// `ServerTrustEvaluating` instance threw an error during trust evaluation.\n    case serverTrustEvaluationFailed(reason: ServerTrustFailureReason)\n    /// `Session` which issued the `Request` was deinitialized, most likely because its reference went out of scope.\n    case sessionDeinitialized\n    /// `Session` was explicitly invalidated, possibly with the `Error` produced by the underlying `URLSession`.\n    case sessionInvalidated(error: Error?)\n    /// `URLSessionTask` completed with error.\n    case sessionTaskFailed(error: Error)\n    /// `URLRequest` failed validation.\n    case urlRequestValidationFailed(reason: URLRequestValidationFailureReason)\n}\n\nextension Error {\n    /// Returns the instance cast as an `AFError`.\n    public var asAFError: AFError? {\n        return self as? AFError\n    }\n\n    /// Returns the instance cast as an `AFError`. If casting fails, a `fatalError` with the specified `message` is thrown.\n    public func asAFError(orFailWith message: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> AFError {\n        guard let afError = self as? AFError else {\n            fatalError(message(), file: file, line: line)\n        }\n        return afError\n    }\n\n    /// Casts the instance as `AFError` or returns `defaultAFError`\n    func asAFError(or defaultAFError: @autoclosure () -> AFError) -> AFError {\n        return self as? AFError ?? defaultAFError()\n    }\n}\n\n// MARK: - Error Booleans\n\nextension AFError {\n    /// Returns whether the instance is `.sessionDeinitialized`.\n    public var isSessionDeinitializedError: Bool {\n        if case .sessionDeinitialized = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.sessionInvalidated`.\n    public var isSessionInvalidatedError: Bool {\n        if case .sessionInvalidated = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.explicitlyCancelled`.\n    public var isExplicitlyCancelledError: Bool {\n        if case .explicitlyCancelled = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.invalidURL`.\n    public var isInvalidURLError: Bool {\n        if case .invalidURL = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.parameterEncodingFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isParameterEncodingError: Bool {\n        if case .parameterEncodingFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.parameterEncoderFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isParameterEncoderError: Bool {\n        if case .parameterEncoderFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.multipartEncodingFailed`. When `true`, the `url` and `underlyingError`\n    /// properties will contain the associated values.\n    public var isMultipartEncodingError: Bool {\n        if case .multipartEncodingFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.requestAdaptationFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isRequestAdaptationError: Bool {\n        if case .requestAdaptationFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.responseValidationFailed`. When `true`, the `acceptableContentTypes`,\n    /// `responseContentType`,  `responseCode`, and `underlyingError` properties will contain the associated values.\n    public var isResponseValidationError: Bool {\n        if case .responseValidationFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.responseSerializationFailed`. When `true`, the `failedStringEncoding` and\n    /// `underlyingError` properties will contain the associated values.\n    public var isResponseSerializationError: Bool {\n        if case .responseSerializationFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `.serverTrustEvaluationFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isServerTrustEvaluationError: Bool {\n        if case .serverTrustEvaluationFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `requestRetryFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isRequestRetryError: Bool {\n        if case .requestRetryFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `createUploadableFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isCreateUploadableError: Bool {\n        if case .createUploadableFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `createURLRequestFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isCreateURLRequestError: Bool {\n        if case .createURLRequestFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `downloadedFileMoveFailed`. When `true`, the `destination` and `underlyingError` properties will\n    /// contain the associated values.\n    public var isDownloadedFileMoveError: Bool {\n        if case .downloadedFileMoveFailed = self { return true }\n        return false\n    }\n\n    /// Returns whether the instance is `createURLRequestFailed`. When `true`, the `underlyingError` property will\n    /// contain the associated value.\n    public var isSessionTaskError: Bool {\n        if case .sessionTaskFailed = self { return true }\n        return false\n    }\n}\n\n// MARK: - Convenience Properties\n\nextension AFError {\n    /// The `URLConvertible` associated with the error.\n    public var urlConvertible: URLConvertible? {\n        guard case let .invalidURL(url) = self else { return nil }\n        return url\n    }\n\n    /// The `URL` associated with the error.\n    public var url: URL? {\n        guard case let .multipartEncodingFailed(reason) = self else { return nil }\n        return reason.url\n    }\n\n    /// The underlying `Error` responsible for generating the failure associated with `.sessionInvalidated`,\n    /// `.parameterEncodingFailed`, `.parameterEncoderFailed`, `.multipartEncodingFailed`, `.requestAdaptationFailed`,\n    /// `.responseSerializationFailed`, `.requestRetryFailed` errors.\n    public var underlyingError: Error? {\n        switch self {\n        case let .multipartEncodingFailed(reason):\n            return reason.underlyingError\n        case let .parameterEncodingFailed(reason):\n            return reason.underlyingError\n        case let .parameterEncoderFailed(reason):\n            return reason.underlyingError\n        case let .requestAdaptationFailed(error):\n            return error\n        case let .requestRetryFailed(retryError, _):\n            return retryError\n        case let .responseValidationFailed(reason):\n            return reason.underlyingError\n        case let .responseSerializationFailed(reason):\n            return reason.underlyingError\n        case let .serverTrustEvaluationFailed(reason):\n            return reason.underlyingError\n        case let .sessionInvalidated(error):\n            return error\n        case let .createUploadableFailed(error):\n            return error\n        case let .createURLRequestFailed(error):\n            return error\n        case let .downloadedFileMoveFailed(error, _, _):\n            return error\n        case let .sessionTaskFailed(error):\n            return error\n        case .explicitlyCancelled,\n             .invalidURL,\n             .sessionDeinitialized,\n             .urlRequestValidationFailed:\n            return nil\n        }\n    }\n\n    /// The acceptable `Content-Type`s of a `.responseValidationFailed` error.\n    public var acceptableContentTypes: [String]? {\n        guard case let .responseValidationFailed(reason) = self else { return nil }\n        return reason.acceptableContentTypes\n    }\n\n    /// The response `Content-Type` of a `.responseValidationFailed` error.\n    public var responseContentType: String? {\n        guard case let .responseValidationFailed(reason) = self else { return nil }\n        return reason.responseContentType\n    }\n\n    /// The response code of a `.responseValidationFailed` error.\n    public var responseCode: Int? {\n        guard case let .responseValidationFailed(reason) = self else { return nil }\n        return reason.responseCode\n    }\n\n    /// The `String.Encoding` associated with a failed `.stringResponse()` call.\n    public var failedStringEncoding: String.Encoding? {\n        guard case let .responseSerializationFailed(reason) = self else { return nil }\n        return reason.failedStringEncoding\n    }\n\n    /// The `source` URL of a `.downloadedFileMoveFailed` error.\n    public var sourceURL: URL? {\n        guard case let .downloadedFileMoveFailed(_, source, _) = self else { return nil }\n        return source\n    }\n\n    /// The `destination` URL of a `.downloadedFileMoveFailed` error.\n    public var destinationURL: URL? {\n        guard case let .downloadedFileMoveFailed(_, _, destination) = self else { return nil }\n        return destination\n    }\n}\n\nextension AFError.ParameterEncodingFailureReason {\n    var underlyingError: Error? {\n        switch self {\n        case let .jsonEncodingFailed(error),\n             let .customEncodingFailed(error):\n            return error\n        case .missingURL:\n            return nil\n        }\n    }\n}\n\nextension AFError.ParameterEncoderFailureReason {\n    var underlyingError: Error? {\n        switch self {\n        case let .encoderFailed(error):\n            return error\n        case .missingRequiredComponent:\n            return nil\n        }\n    }\n}\n\nextension AFError.MultipartEncodingFailureReason {\n    var url: URL? {\n        switch self {\n        case let .bodyPartURLInvalid(url),\n             let .bodyPartFilenameInvalid(url),\n             let .bodyPartFileNotReachable(url),\n             let .bodyPartFileIsDirectory(url),\n             let .bodyPartFileSizeNotAvailable(url),\n             let .bodyPartInputStreamCreationFailed(url),\n             let .outputStreamCreationFailed(url),\n             let .outputStreamFileAlreadyExists(url),\n             let .outputStreamURLInvalid(url),\n             let .bodyPartFileNotReachableWithError(url, _),\n             let .bodyPartFileSizeQueryFailedWithError(url, _):\n            return url\n        case .outputStreamWriteFailed,\n             .inputStreamReadFailed:\n            return nil\n        }\n    }\n\n    var underlyingError: Error? {\n        switch self {\n        case let .bodyPartFileNotReachableWithError(_, error),\n             let .bodyPartFileSizeQueryFailedWithError(_, error),\n             let .outputStreamWriteFailed(error),\n             let .inputStreamReadFailed(error):\n            return error\n        case .bodyPartURLInvalid,\n             .bodyPartFilenameInvalid,\n             .bodyPartFileNotReachable,\n             .bodyPartFileIsDirectory,\n             .bodyPartFileSizeNotAvailable,\n             .bodyPartInputStreamCreationFailed,\n             .outputStreamCreationFailed,\n             .outputStreamFileAlreadyExists,\n             .outputStreamURLInvalid:\n            return nil\n        }\n    }\n}\n\nextension AFError.ResponseValidationFailureReason {\n    var acceptableContentTypes: [String]? {\n        switch self {\n        case let .missingContentType(types),\n             let .unacceptableContentType(types, _):\n            return types\n        case .dataFileNil,\n             .dataFileReadFailed,\n             .unacceptableStatusCode,\n             .customValidationFailed:\n            return nil\n        }\n    }\n\n    var responseContentType: String? {\n        switch self {\n        case let .unacceptableContentType(_, responseType):\n            return responseType\n        case .dataFileNil,\n             .dataFileReadFailed,\n             .missingContentType,\n             .unacceptableStatusCode,\n             .customValidationFailed:\n            return nil\n        }\n    }\n\n    var responseCode: Int? {\n        switch self {\n        case let .unacceptableStatusCode(code):\n            return code\n        case .dataFileNil,\n             .dataFileReadFailed,\n             .missingContentType,\n             .unacceptableContentType,\n             .customValidationFailed:\n            return nil\n        }\n    }\n\n    var underlyingError: Error? {\n        switch self {\n        case let .customValidationFailed(error):\n            return error\n        case .dataFileNil,\n             .dataFileReadFailed,\n             .missingContentType,\n             .unacceptableContentType,\n             .unacceptableStatusCode:\n            return nil\n        }\n    }\n}\n\nextension AFError.ResponseSerializationFailureReason {\n    var failedStringEncoding: String.Encoding? {\n        switch self {\n        case let .stringSerializationFailed(encoding):\n            return encoding\n        case .inputDataNilOrZeroLength,\n             .inputFileNil,\n             .inputFileReadFailed(_),\n             .jsonSerializationFailed(_),\n             .decodingFailed(_),\n             .customSerializationFailed(_),\n             .invalidEmptyResponse:\n            return nil\n        }\n    }\n\n    var underlyingError: Error? {\n        switch self {\n        case let .jsonSerializationFailed(error),\n             let .decodingFailed(error),\n             let .customSerializationFailed(error):\n            return error\n        case .inputDataNilOrZeroLength,\n             .inputFileNil,\n             .inputFileReadFailed,\n             .stringSerializationFailed,\n             .invalidEmptyResponse:\n            return nil\n        }\n    }\n}\n\nextension AFError.ServerTrustFailureReason {\n    var output: AFError.ServerTrustFailureReason.Output? {\n        switch self {\n        case let .defaultEvaluationFailed(output),\n             let .hostValidationFailed(output),\n             let .revocationCheckFailed(output, _):\n            return output\n        case .noRequiredEvaluator,\n             .noCertificatesFound,\n             .noPublicKeysFound,\n             .policyApplicationFailed,\n             .settingAnchorCertificatesFailed,\n             .revocationPolicyCreationFailed,\n             .trustEvaluationFailed,\n             .certificatePinningFailed,\n             .publicKeyPinningFailed,\n             .customEvaluationFailed:\n            return nil\n        }\n    }\n\n    var underlyingError: Error? {\n        switch self {\n        case let .customEvaluationFailed(error):\n            return error\n        case let .trustEvaluationFailed(error):\n            return error\n        case .noRequiredEvaluator,\n             .noCertificatesFound,\n             .noPublicKeysFound,\n             .policyApplicationFailed,\n             .settingAnchorCertificatesFailed,\n             .revocationPolicyCreationFailed,\n             .defaultEvaluationFailed,\n             .hostValidationFailed,\n             .revocationCheckFailed,\n             .certificatePinningFailed,\n             .publicKeyPinningFailed:\n            return nil\n        }\n    }\n}\n\n// MARK: - Error Descriptions\n\nextension AFError: LocalizedError {\n    public var errorDescription: String? {\n        switch self {\n        case .explicitlyCancelled:\n            return \"Request explicitly cancelled.\"\n        case let .invalidURL(url):\n            return \"URL is not valid: \\(url)\"\n        case let .parameterEncodingFailed(reason):\n            return reason.localizedDescription\n        case let .parameterEncoderFailed(reason):\n            return reason.localizedDescription\n        case let .multipartEncodingFailed(reason):\n            return reason.localizedDescription\n        case let .requestAdaptationFailed(error):\n            return \"Request adaption failed with error: \\(error.localizedDescription)\"\n        case let .responseValidationFailed(reason):\n            return reason.localizedDescription\n        case let .responseSerializationFailed(reason):\n            return reason.localizedDescription\n        case let .requestRetryFailed(retryError, originalError):\n            return \"\"\"\n            Request retry failed with retry error: \\(retryError.localizedDescription), \\\n            original error: \\(originalError.localizedDescription)\n            \"\"\"\n        case .sessionDeinitialized:\n            return \"\"\"\n            Session was invalidated without error, so it was likely deinitialized unexpectedly. \\\n            Be sure to retain a reference to your Session for the duration of your requests.\n            \"\"\"\n        case let .sessionInvalidated(error):\n            return \"Session was invalidated with error: \\(error?.localizedDescription ?? \"No description.\")\"\n        case let .serverTrustEvaluationFailed(reason):\n            return \"Server trust evaluation failed due to reason: \\(reason.localizedDescription)\"\n        case let .urlRequestValidationFailed(reason):\n            return \"URLRequest validation failed due to reason: \\(reason.localizedDescription)\"\n        case let .createUploadableFailed(error):\n            return \"Uploadable creation failed with error: \\(error.localizedDescription)\"\n        case let .createURLRequestFailed(error):\n            return \"URLRequest creation failed with error: \\(error.localizedDescription)\"\n        case let .downloadedFileMoveFailed(error, source, destination):\n            return \"Moving downloaded file from: \\(source) to: \\(destination) failed with error: \\(error.localizedDescription)\"\n        case let .sessionTaskFailed(error):\n            return \"URLSessionTask failed with error: \\(error.localizedDescription)\"\n        }\n    }\n}\n\nextension AFError.ParameterEncodingFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case .missingURL:\n            return \"URL request to encode was missing a URL\"\n        case let .jsonEncodingFailed(error):\n            return \"JSON could not be encoded because of error:\\n\\(error.localizedDescription)\"\n        case let .customEncodingFailed(error):\n            return \"Custom parameter encoder failed with error: \\(error.localizedDescription)\"\n        }\n    }\n}\n\nextension AFError.ParameterEncoderFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case let .missingRequiredComponent(component):\n            return \"Encoding failed due to a missing request component: \\(component)\"\n        case let .encoderFailed(error):\n            return \"The underlying encoder failed with the error: \\(error)\"\n        }\n    }\n}\n\nextension AFError.MultipartEncodingFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case let .bodyPartURLInvalid(url):\n            return \"The URL provided is not a file URL: \\(url)\"\n        case let .bodyPartFilenameInvalid(url):\n            return \"The URL provided does not have a valid filename: \\(url)\"\n        case let .bodyPartFileNotReachable(url):\n            return \"The URL provided is not reachable: \\(url)\"\n        case let .bodyPartFileNotReachableWithError(url, error):\n            return \"\"\"\n            The system returned an error while checking the provided URL for reachability.\n            URL: \\(url)\n            Error: \\(error)\n            \"\"\"\n        case let .bodyPartFileIsDirectory(url):\n            return \"The URL provided is a directory: \\(url)\"\n        case let .bodyPartFileSizeNotAvailable(url):\n            return \"Could not fetch the file size from the provided URL: \\(url)\"\n        case let .bodyPartFileSizeQueryFailedWithError(url, error):\n            return \"\"\"\n            The system returned an error while attempting to fetch the file size from the provided URL.\n            URL: \\(url)\n            Error: \\(error)\n            \"\"\"\n        case let .bodyPartInputStreamCreationFailed(url):\n            return \"Failed to create an InputStream for the provided URL: \\(url)\"\n        case let .outputStreamCreationFailed(url):\n            return \"Failed to create an OutputStream for URL: \\(url)\"\n        case let .outputStreamFileAlreadyExists(url):\n            return \"A file already exists at the provided URL: \\(url)\"\n        case let .outputStreamURLInvalid(url):\n            return \"The provided OutputStream URL is invalid: \\(url)\"\n        case let .outputStreamWriteFailed(error):\n            return \"OutputStream write failed with error: \\(error)\"\n        case let .inputStreamReadFailed(error):\n            return \"InputStream read failed with error: \\(error)\"\n        }\n    }\n}\n\nextension AFError.ResponseSerializationFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case .inputDataNilOrZeroLength:\n            return \"Response could not be serialized, input data was nil or zero length.\"\n        case .inputFileNil:\n            return \"Response could not be serialized, input file was nil.\"\n        case let .inputFileReadFailed(url):\n            return \"Response could not be serialized, input file could not be read: \\(url).\"\n        case let .stringSerializationFailed(encoding):\n            return \"String could not be serialized with encoding: \\(encoding).\"\n        case let .jsonSerializationFailed(error):\n            return \"JSON could not be serialized because of error:\\n\\(error.localizedDescription)\"\n        case let .invalidEmptyResponse(type):\n            return \"\"\"\n            Empty response could not be serialized to type: \\(type). \\\n            Use Empty as the expected type for such responses.\n            \"\"\"\n        case let .decodingFailed(error):\n            return \"Response could not be decoded because of error:\\n\\(error.localizedDescription)\"\n        case let .customSerializationFailed(error):\n            return \"Custom response serializer failed with error:\\n\\(error.localizedDescription)\"\n        }\n    }\n}\n\nextension AFError.ResponseValidationFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case .dataFileNil:\n            return \"Response could not be validated, data file was nil.\"\n        case let .dataFileReadFailed(url):\n            return \"Response could not be validated, data file could not be read: \\(url).\"\n        case let .missingContentType(types):\n            return \"\"\"\n            Response Content-Type was missing and acceptable content types \\\n            (\\(types.joined(separator: \",\"))) do not match \"*/*\".\n            \"\"\"\n        case let .unacceptableContentType(acceptableTypes, responseType):\n            return \"\"\"\n            Response Content-Type \"\\(responseType)\" does not match any acceptable types: \\\n            \\(acceptableTypes.joined(separator: \",\")).\n            \"\"\"\n        case let .unacceptableStatusCode(code):\n            return \"Response status code was unacceptable: \\(code).\"\n        case let .customValidationFailed(error):\n            return \"Custom response validation failed with error: \\(error.localizedDescription)\"\n        }\n    }\n}\n\nextension AFError.ServerTrustFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case let .noRequiredEvaluator(host):\n            return \"A ServerTrustEvaluating value is required for host \\(host) but none was found.\"\n        case .noCertificatesFound:\n            return \"No certificates were found or provided for evaluation.\"\n        case .noPublicKeysFound:\n            return \"No public keys were found or provided for evaluation.\"\n        case .policyApplicationFailed:\n            return \"Attempting to set a SecPolicy failed.\"\n        case .settingAnchorCertificatesFailed:\n            return \"Attempting to set the provided certificates as anchor certificates failed.\"\n        case .revocationPolicyCreationFailed:\n            return \"Attempting to create a revocation policy failed.\"\n        case let .trustEvaluationFailed(error):\n            return \"SecTrust evaluation failed with error: \\(error?.localizedDescription ?? \"None\")\"\n        case let .defaultEvaluationFailed(output):\n            return \"Default evaluation failed for host \\(output.host).\"\n        case let .hostValidationFailed(output):\n            return \"Host validation failed for host \\(output.host).\"\n        case let .revocationCheckFailed(output, _):\n            return \"Revocation check failed for host \\(output.host).\"\n        case let .certificatePinningFailed(host, _, _, _):\n            return \"Certificate pinning failed for host \\(host).\"\n        case let .publicKeyPinningFailed(host, _, _, _):\n            return \"Public key pinning failed for host \\(host).\"\n        case let .customEvaluationFailed(error):\n            return \"Custom trust evaluation failed with error: \\(error.localizedDescription)\"\n        }\n    }\n}\n\nextension AFError.URLRequestValidationFailureReason {\n    var localizedDescription: String {\n        switch self {\n        case let .bodyDataInGETRequest(data):\n            return \"\"\"\n            Invalid URLRequest: Requests with GET method cannot have body data:\n            \\(String(decoding: data, as: UTF8.self))\n            \"\"\"\n        }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/Alamofire.swift",
    "content": "//\n//  Alamofire.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\n/// Reference to `Session.default` for quick bootstrapping and examples.\npublic let AF = Session.default\n\n/// Current Alamofire version. Necessary since SPM doesn't use dynamic libraries. Plus this will be more accurate.\nlet version = \"5.0.2\"\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/AlamofireExtended.swift",
    "content": "//\n//  AlamofireExtended.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\n/// Type that acts as a generic extension point for all `AlamofireExtended` types.\npublic struct AlamofireExtension<ExtendedType> {\n    /// Stores the type or meta-type of any extended type.\n    public private(set) var type: ExtendedType\n\n    /// Create an instance from the provided value.\n    ///\n    /// - Parameter type: Instance being extended.\n    public init(_ type: ExtendedType) {\n        self.type = type\n    }\n}\n\n/// Protocol describing the `af` extension points for Alamofire extended types.\npublic protocol AlamofireExtended {\n    /// Type being extended.\n    associatedtype ExtendedType\n\n    /// Static Alamofire extension point.\n    static var af: AlamofireExtension<ExtendedType>.Type { get set }\n    /// Instance Alamofire extension point.\n    var af: AlamofireExtension<ExtendedType> { get set }\n}\n\npublic extension AlamofireExtended {\n    /// Static Alamofire extension point.\n    static var af: AlamofireExtension<Self>.Type {\n        get { return AlamofireExtension<Self>.self }\n        set {}\n    }\n\n    /// Instance Alamofire extension point.\n    var af: AlamofireExtension<Self> {\n        get { return AlamofireExtension(self) }\n        set {}\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/CachedResponseHandler.swift",
    "content": "//\n//  CachedResponseHandler.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A type that handles whether the data task should store the HTTP response in the cache.\npublic protocol CachedResponseHandler {\n    /// Determines whether the HTTP response should be stored in the cache.\n    ///\n    /// The `completion` closure should be passed one of three possible options:\n    ///\n    ///   1. The cached response provided by the server (this is the most common use case).\n    ///   2. A modified version of the cached response (you may want to modify it in some way before caching).\n    ///   3. A `nil` value to prevent the cached response from being stored in the cache.\n    ///\n    /// - Parameters:\n    ///   - task:       The data task whose request resulted in the cached response.\n    ///   - response:   The cached response to potentially store in the cache.\n    ///   - completion: The closure to execute containing cached response, a modified response, or `nil`.\n    func dataTask(_ task: URLSessionDataTask,\n                  willCacheResponse response: CachedURLResponse,\n                  completion: @escaping (CachedURLResponse?) -> Void)\n}\n\n// MARK: -\n\n/// `ResponseCacher` is a convenience `CachedResponseHandler` making it easy to cache, not cache, or modify a cached\n/// response.\npublic struct ResponseCacher {\n    /// Defines the behavior of the `ResponseCacher` type.\n    public enum Behavior {\n        /// Stores the cached response in the cache.\n        case cache\n        /// Prevents the cached response from being stored in the cache.\n        case doNotCache\n        /// Modifies the cached response before storing it in the cache.\n        case modify((URLSessionDataTask, CachedURLResponse) -> CachedURLResponse?)\n    }\n\n    /// Returns a `ResponseCacher` with a follow `Behavior`.\n    public static let cache = ResponseCacher(behavior: .cache)\n    /// Returns a `ResponseCacher` with a do not follow `Behavior`.\n    public static let doNotCache = ResponseCacher(behavior: .doNotCache)\n\n    /// The `Behavior` of the `ResponseCacher`.\n    public let behavior: Behavior\n\n    /// Creates a `ResponseCacher` instance from the `Behavior`.\n    ///\n    /// - Parameter behavior: The `Behavior`.\n    public init(behavior: Behavior) {\n        self.behavior = behavior\n    }\n}\n\nextension ResponseCacher: CachedResponseHandler {\n    public func dataTask(_ task: URLSessionDataTask,\n                         willCacheResponse response: CachedURLResponse,\n                         completion: @escaping (CachedURLResponse?) -> Void) {\n        switch behavior {\n        case .cache:\n            completion(response)\n        case .doNotCache:\n            completion(nil)\n        case let .modify(closure):\n            let response = closure(task, response)\n            completion(response)\n        }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/DispatchQueue+Alamofire.swift",
    "content": "//\n//  DispatchQueue+Alamofire.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Dispatch\nimport Foundation\n\nextension DispatchQueue {\n    /// Execute the provided closure after a `TimeInterval`.\n    ///\n    /// - Parameters:\n    ///   - delay:   `TimeInterval` to delay execution.\n    ///   - closure: Closure to execute.\n    func after(_ delay: TimeInterval, execute closure: @escaping () -> Void) {\n        asyncAfter(deadline: .now() + delay, execute: closure)\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/EventMonitor.swift",
    "content": "//\n//  EventMonitor.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Protocol outlining the lifetime events inside Alamofire. It includes both events received from the various\n/// `URLSession` delegate protocols as well as various events from the lifetime of `Request` and its subclasses.\npublic protocol EventMonitor {\n    /// The `DispatchQueue` onto which Alamofire's root `CompositeEventMonitor` will dispatch events. `.main` by default.\n    var queue: DispatchQueue { get }\n\n    // MARK: - URLSession Events\n\n    // MARK: URLSessionDelegate Events\n\n    /// Event called during `URLSessionDelegate`'s `urlSession(_:didBecomeInvalidWithError:)` method.\n    func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?)\n\n    // MARK: URLSessionTaskDelegate Events\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didReceive:completionHandler:)` method.\n    func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)` method.\n    func urlSession(_ session: URLSession,\n                    task: URLSessionTask,\n                    didSendBodyData bytesSent: Int64,\n                    totalBytesSent: Int64,\n                    totalBytesExpectedToSend: Int64)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:needNewBodyStream:)` method.\n    func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` method.\n    func urlSession(_ session: URLSession,\n                    task: URLSessionTask,\n                    willPerformHTTPRedirection response: HTTPURLResponse,\n                    newRequest request: URLRequest)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didFinishCollecting:)` method.\n    func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:task:didCompleteWithError:)` method.\n    func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?)\n\n    /// Event called during `URLSessionTaskDelegate`'s `urlSession(_:taskIsWaitingForConnectivity:)` method.\n    @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)\n    func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask)\n\n    // MARK: URLSessionDataDelegate Events\n\n    /// Event called during `URLSessionDataDelegate`'s `urlSession(_:dataTask:didReceive:)` method.\n    func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data)\n\n    /// Event called during `URLSessionDataDelegate`'s `urlSession(_:dataTask:willCacheResponse:completionHandler:)` method.\n    func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse)\n\n    // MARK: URLSessionDownloadDelegate Events\n\n    /// Event called during `URLSessionDownloadDelegate`'s `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)` method.\n    func urlSession(_ session: URLSession,\n                    downloadTask: URLSessionDownloadTask,\n                    didResumeAtOffset fileOffset: Int64,\n                    expectedTotalBytes: Int64)\n\n    /// Event called during `URLSessionDownloadDelegate`'s `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)` method.\n    func urlSession(_ session: URLSession,\n                    downloadTask: URLSessionDownloadTask,\n                    didWriteData bytesWritten: Int64,\n                    totalBytesWritten: Int64,\n                    totalBytesExpectedToWrite: Int64)\n\n    /// Event called during `URLSessionDownloadDelegate`'s `urlSession(_:downloadTask:didFinishDownloadingTo:)` method.\n    func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL)\n\n    // MARK: - Request Events\n\n    /// Event called when a `URLRequest` is first created for a `Request`. If a `RequestAdapter` is active, the\n    /// `URLRequest` will be adapted before being issued.\n    func request(_ request: Request, didCreateInitialURLRequest urlRequest: URLRequest)\n\n    /// Event called when the attempt to create a `URLRequest` from a `Request`'s original `URLRequestConvertible` value fails.\n    func request(_ request: Request, didFailToCreateURLRequestWithError error: AFError)\n\n    /// Event called when a `RequestAdapter` adapts the `Request`'s initial `URLRequest`.\n    func request(_ request: Request, didAdaptInitialRequest initialRequest: URLRequest, to adaptedRequest: URLRequest)\n\n    /// Event called when a `RequestAdapter` fails to adapt the `Request`'s initial `URLRequest`.\n    func request(_ request: Request, didFailToAdaptURLRequest initialRequest: URLRequest, withError error: AFError)\n\n    /// Event called when a final `URLRequest` is created for a `Request`.\n    func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest)\n\n    /// Event called when a `URLSessionTask` subclass instance is created for a `Request`.\n    func request(_ request: Request, didCreateTask task: URLSessionTask)\n\n    /// Event called when a `Request` receives a `URLSessionTaskMetrics` value.\n    func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics)\n\n    /// Event called when a `Request` fails due to an error created by Alamofire. e.g. When certificate pinning fails.\n    func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: AFError)\n\n    /// Event called when a `Request`'s task completes, possibly with an error. A `Request` may receive this event\n    /// multiple times if it is retried.\n    func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?)\n\n    /// Event called when a `Request` is about to be retried.\n    func requestIsRetrying(_ request: Request)\n\n    /// Event called when a `Request` finishes and response serializers are being called.\n    func requestDidFinish(_ request: Request)\n\n    /// Event called when a `Request` receives a `resume` call.\n    func requestDidResume(_ request: Request)\n\n    /// Event called when a `Request`'s associated `URLSessionTask` is resumed.\n    func request(_ request: Request, didResumeTask task: URLSessionTask)\n\n    /// Event called when a `Request` receives a `suspend` call.\n    func requestDidSuspend(_ request: Request)\n\n    /// Event called when a `Request`'s associated `URLSessionTask` is suspended.\n    func request(_ request: Request, didSuspendTask task: URLSessionTask)\n\n    /// Event called when a `Request` receives a `cancel` call.\n    func requestDidCancel(_ request: Request)\n\n    /// Event called when a `Request`'s associated `URLSessionTask` is cancelled.\n    func request(_ request: Request, didCancelTask task: URLSessionTask)\n\n    // MARK: DataRequest Events\n\n    /// Event called when a `DataRequest` calls a `Validation`.\n    func request(_ request: DataRequest,\n                 didValidateRequest urlRequest: URLRequest?,\n                 response: HTTPURLResponse,\n                 data: Data?,\n                 withResult result: Request.ValidationResult)\n\n    /// Event called when a `DataRequest` creates a `DataResponse<Data?>` value without calling a `ResponseSerializer`.\n    func request(_ request: DataRequest, didParseResponse response: DataResponse<Data?, AFError>)\n\n    /// Event called when a `DataRequest` calls a `ResponseSerializer` and creates a generic `DataResponse<Value, AFError>`.\n    func request<Value>(_ request: DataRequest, didParseResponse response: DataResponse<Value, AFError>)\n\n    // MARK: UploadRequest Events\n\n    /// Event called when an `UploadRequest` creates its `Uploadable` value, indicating the type of upload it represents.\n    func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable)\n\n    /// Event called when an `UploadRequest` failed to create its `Uploadable` value due to an error.\n    func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: AFError)\n\n    /// Event called when an `UploadRequest` provides the `InputStream` from its `Uploadable` value. This only occurs if\n    /// the `InputStream` does not wrap a `Data` value or file `URL`.\n    func request(_ request: UploadRequest, didProvideInputStream stream: InputStream)\n\n    // MARK: DownloadRequest Events\n\n    /// Event called when a `DownloadRequest`'s `URLSessionDownloadTask` finishes and the temporary file has been moved.\n    func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: Result<URL, AFError>)\n\n    /// Event called when a `DownloadRequest`'s `Destination` closure is called and creates the destination URL the\n    /// downloaded file will be moved to.\n    func request(_ request: DownloadRequest, didCreateDestinationURL url: URL)\n\n    /// Event called when a `DownloadRequest` calls a `Validation`.\n    func request(_ request: DownloadRequest,\n                 didValidateRequest urlRequest: URLRequest?,\n                 response: HTTPURLResponse,\n                 fileURL: URL?,\n                 withResult result: Request.ValidationResult)\n\n    /// Event called when a `DownloadRequest` creates a `DownloadResponse<URL?, AFError>` without calling a `ResponseSerializer`.\n    func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse<URL?, AFError>)\n\n    /// Event called when a `DownloadRequest` calls a `DownloadResponseSerializer` and creates a generic `DownloadResponse<Value, AFError>`\n    func request<Value>(_ request: DownloadRequest, didParseResponse response: DownloadResponse<Value, AFError>)\n}\n\nextension EventMonitor {\n    /// The default queue on which `CompositeEventMonitor`s will call the `EventMonitor` methods. `.main` by default.\n    public var queue: DispatchQueue { return .main }\n\n    // MARK: Default Implementations\n\n    public func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {}\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           didReceive challenge: URLAuthenticationChallenge) {}\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           didSendBodyData bytesSent: Int64,\n                           totalBytesSent: Int64,\n                           totalBytesExpectedToSend: Int64) {}\n    public func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) {}\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           willPerformHTTPRedirection response: HTTPURLResponse,\n                           newRequest request: URLRequest) {}\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           didFinishCollecting metrics: URLSessionTaskMetrics) {}\n    public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {}\n    public func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {}\n    public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {}\n    public func urlSession(_ session: URLSession,\n                           dataTask: URLSessionDataTask,\n                           willCacheResponse proposedResponse: CachedURLResponse) {}\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didResumeAtOffset fileOffset: Int64,\n                           expectedTotalBytes: Int64) {}\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didWriteData bytesWritten: Int64,\n                           totalBytesWritten: Int64,\n                           totalBytesExpectedToWrite: Int64) {}\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didFinishDownloadingTo location: URL) {}\n    public func request(_ request: Request, didCreateInitialURLRequest urlRequest: URLRequest) {}\n    public func request(_ request: Request, didFailToCreateURLRequestWithError error: AFError) {}\n    public func request(_ request: Request,\n                        didAdaptInitialRequest initialRequest: URLRequest,\n                        to adaptedRequest: URLRequest) {}\n    public func request(_ request: Request,\n                        didFailToAdaptURLRequest initialRequest: URLRequest,\n                        withError error: AFError) {}\n    public func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) {}\n    public func request(_ request: Request, didCreateTask task: URLSessionTask) {}\n    public func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) {}\n    public func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: AFError) {}\n    public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?) {}\n    public func requestIsRetrying(_ request: Request) {}\n    public func requestDidFinish(_ request: Request) {}\n    public func requestDidResume(_ request: Request) {}\n    public func request(_ request: Request, didResumeTask task: URLSessionTask) {}\n    public func requestDidSuspend(_ request: Request) {}\n    public func request(_ request: Request, didSuspendTask task: URLSessionTask) {}\n    public func requestDidCancel(_ request: Request) {}\n    public func request(_ request: Request, didCancelTask task: URLSessionTask) {}\n    public func request(_ request: DataRequest,\n                        didValidateRequest urlRequest: URLRequest?,\n                        response: HTTPURLResponse,\n                        data: Data?,\n                        withResult result: Request.ValidationResult) {}\n    public func request(_ request: DataRequest, didParseResponse response: DataResponse<Data?, AFError>) {}\n    public func request<Value>(_ request: DataRequest, didParseResponse response: DataResponse<Value, AFError>) {}\n    public func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) {}\n    public func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: AFError) {}\n    public func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) {}\n    public func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: Result<URL, AFError>) {}\n    public func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) {}\n    public func request(_ request: DownloadRequest,\n                        didValidateRequest urlRequest: URLRequest?,\n                        response: HTTPURLResponse,\n                        fileURL: URL?,\n                        withResult result: Request.ValidationResult) {}\n    public func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse<URL?, AFError>) {}\n    public func request<Value>(_ request: DownloadRequest, didParseResponse response: DownloadResponse<Value, AFError>) {}\n}\n\n/// An `EventMonitor` which can contain multiple `EventMonitor`s and calls their methods on their queues.\npublic final class CompositeEventMonitor: EventMonitor {\n    public let queue = DispatchQueue(label: \"org.alamofire.compositeEventMonitor\", qos: .background)\n\n    let monitors: [EventMonitor]\n\n    init(monitors: [EventMonitor]) {\n        self.monitors = monitors\n    }\n\n    func performEvent(_ event: @escaping (EventMonitor) -> Void) {\n        queue.async {\n            for monitor in self.monitors {\n                monitor.queue.async { event(monitor) }\n            }\n        }\n    }\n\n    public func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {\n        performEvent { $0.urlSession(session, didBecomeInvalidWithError: error) }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           didReceive challenge: URLAuthenticationChallenge) {\n        performEvent { $0.urlSession(session, task: task, didReceive: challenge) }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           didSendBodyData bytesSent: Int64,\n                           totalBytesSent: Int64,\n                           totalBytesExpectedToSend: Int64) {\n        performEvent {\n            $0.urlSession(session,\n                          task: task,\n                          didSendBodyData: bytesSent,\n                          totalBytesSent: totalBytesSent,\n                          totalBytesExpectedToSend: totalBytesExpectedToSend)\n        }\n    }\n\n    public func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) {\n        performEvent {\n            $0.urlSession(session, taskNeedsNewBodyStream: task)\n        }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           task: URLSessionTask,\n                           willPerformHTTPRedirection response: HTTPURLResponse,\n                           newRequest request: URLRequest) {\n        performEvent {\n            $0.urlSession(session,\n                          task: task,\n                          willPerformHTTPRedirection: response,\n                          newRequest: request)\n        }\n    }\n\n    public func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {\n        performEvent { $0.urlSession(session, task: task, didFinishCollecting: metrics) }\n    }\n\n    public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {\n        performEvent { $0.urlSession(session, task: task, didCompleteWithError: error) }\n    }\n\n    @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)\n    public func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {\n        performEvent { $0.urlSession(session, taskIsWaitingForConnectivity: task) }\n    }\n\n    public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {\n        performEvent { $0.urlSession(session, dataTask: dataTask, didReceive: data) }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           dataTask: URLSessionDataTask,\n                           willCacheResponse proposedResponse: CachedURLResponse) {\n        performEvent { $0.urlSession(session, dataTask: dataTask, willCacheResponse: proposedResponse) }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didResumeAtOffset fileOffset: Int64,\n                           expectedTotalBytes: Int64) {\n        performEvent {\n            $0.urlSession(session,\n                          downloadTask: downloadTask,\n                          didResumeAtOffset: fileOffset,\n                          expectedTotalBytes: expectedTotalBytes)\n        }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didWriteData bytesWritten: Int64,\n                           totalBytesWritten: Int64,\n                           totalBytesExpectedToWrite: Int64) {\n        performEvent {\n            $0.urlSession(session,\n                          downloadTask: downloadTask,\n                          didWriteData: bytesWritten,\n                          totalBytesWritten: totalBytesWritten,\n                          totalBytesExpectedToWrite: totalBytesExpectedToWrite)\n        }\n    }\n\n    public func urlSession(_ session: URLSession,\n                           downloadTask: URLSessionDownloadTask,\n                           didFinishDownloadingTo location: URL) {\n        performEvent { $0.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location) }\n    }\n\n    public func request(_ request: Request, didCreateInitialURLRequest urlRequest: URLRequest) {\n        performEvent { $0.request(request, didCreateInitialURLRequest: urlRequest) }\n    }\n\n    public func request(_ request: Request, didFailToCreateURLRequestWithError error: AFError) {\n        performEvent { $0.request(request, didFailToCreateURLRequestWithError: error) }\n    }\n\n    public func request(_ request: Request, didAdaptInitialRequest initialRequest: URLRequest, to adaptedRequest: URLRequest) {\n        performEvent { $0.request(request, didAdaptInitialRequest: initialRequest, to: adaptedRequest) }\n    }\n\n    public func request(_ request: Request, didFailToAdaptURLRequest initialRequest: URLRequest, withError error: AFError) {\n        performEvent { $0.request(request, didFailToAdaptURLRequest: initialRequest, withError: error) }\n    }\n\n    public func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) {\n        performEvent { $0.request(request, didCreateURLRequest: urlRequest) }\n    }\n\n    public func request(_ request: Request, didCreateTask task: URLSessionTask) {\n        performEvent { $0.request(request, didCreateTask: task) }\n    }\n\n    public func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) {\n        performEvent { $0.request(request, didGatherMetrics: metrics) }\n    }\n\n    public func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: AFError) {\n        performEvent { $0.request(request, didFailTask: task, earlyWithError: error) }\n    }\n\n    public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?) {\n        performEvent { $0.request(request, didCompleteTask: task, with: error) }\n    }\n\n    public func requestIsRetrying(_ request: Request) {\n        performEvent { $0.requestIsRetrying(request) }\n    }\n\n    public func requestDidFinish(_ request: Request) {\n        performEvent { $0.requestDidFinish(request) }\n    }\n\n    public func requestDidResume(_ request: Request) {\n        performEvent { $0.requestDidResume(request) }\n    }\n\n    public func request(_ request: Request, didResumeTask task: URLSessionTask) {\n        performEvent { $0.request(request, didResumeTask: task) }\n    }\n\n    public func requestDidSuspend(_ request: Request) {\n        performEvent { $0.requestDidSuspend(request) }\n    }\n\n    public func request(_ request: Request, didSuspendTask task: URLSessionTask) {\n        performEvent { $0.request(request, didSuspendTask: task) }\n    }\n\n    public func requestDidCancel(_ request: Request) {\n        performEvent { $0.requestDidCancel(request) }\n    }\n\n    public func request(_ request: Request, didCancelTask task: URLSessionTask) {\n        performEvent { $0.request(request, didCancelTask: task) }\n    }\n\n    public func request(_ request: DataRequest,\n                        didValidateRequest urlRequest: URLRequest?,\n                        response: HTTPURLResponse,\n                        data: Data?,\n                        withResult result: Request.ValidationResult) {\n        performEvent { $0.request(request,\n                                  didValidateRequest: urlRequest,\n                                  response: response,\n                                  data: data,\n                                  withResult: result)\n        }\n    }\n\n    public func request(_ request: DataRequest, didParseResponse response: DataResponse<Data?, AFError>) {\n        performEvent { $0.request(request, didParseResponse: response) }\n    }\n\n    public func request<Value>(_ request: DataRequest, didParseResponse response: DataResponse<Value, AFError>) {\n        performEvent { $0.request(request, didParseResponse: response) }\n    }\n\n    public func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) {\n        performEvent { $0.request(request, didCreateUploadable: uploadable) }\n    }\n\n    public func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: AFError) {\n        performEvent { $0.request(request, didFailToCreateUploadableWithError: error) }\n    }\n\n    public func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) {\n        performEvent { $0.request(request, didProvideInputStream: stream) }\n    }\n\n    public func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: Result<URL, AFError>) {\n        performEvent { $0.request(request, didFinishDownloadingUsing: task, with: result) }\n    }\n\n    public func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) {\n        performEvent { $0.request(request, didCreateDestinationURL: url) }\n    }\n\n    public func request(_ request: DownloadRequest,\n                        didValidateRequest urlRequest: URLRequest?,\n                        response: HTTPURLResponse,\n                        fileURL: URL?,\n                        withResult result: Request.ValidationResult) {\n        performEvent { $0.request(request,\n                                  didValidateRequest: urlRequest,\n                                  response: response,\n                                  fileURL: fileURL,\n                                  withResult: result) }\n    }\n\n    public func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse<URL?, AFError>) {\n        performEvent { $0.request(request, didParseResponse: response) }\n    }\n\n    public func request<Value>(_ request: DownloadRequest, didParseResponse response: DownloadResponse<Value, AFError>) {\n        performEvent { $0.request(request, didParseResponse: response) }\n    }\n}\n\n/// `EventMonitor` that allows optional closures to be set to receive events.\nopen class ClosureEventMonitor: EventMonitor {\n    /// Closure called on the `urlSession(_:didBecomeInvalidWithError:)` event.\n    open var sessionDidBecomeInvalidWithError: ((URLSession, Error?) -> Void)?\n\n    /// Closure called on the `urlSession(_:task:didReceive:completionHandler:)`.\n    open var taskDidReceiveChallenge: ((URLSession, URLSessionTask, URLAuthenticationChallenge) -> Void)?\n\n    /// Closure that receives `urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:)` event.\n    open var taskDidSendBodyData: ((URLSession, URLSessionTask, Int64, Int64, Int64) -> Void)?\n\n    /// Closure called on the `urlSession(_:task:needNewBodyStream:)` event.\n    open var taskNeedNewBodyStream: ((URLSession, URLSessionTask) -> Void)?\n\n    /// Closure called on the `urlSession(_:task:willPerformHTTPRedirection:newRequest:completionHandler:)` event.\n    open var taskWillPerformHTTPRedirection: ((URLSession, URLSessionTask, HTTPURLResponse, URLRequest) -> Void)?\n\n    /// Closure called on the `urlSession(_:task:didFinishCollecting:)` event.\n    open var taskDidFinishCollectingMetrics: ((URLSession, URLSessionTask, URLSessionTaskMetrics) -> Void)?\n\n    /// Closure called on the `urlSession(_:task:didCompleteWithError:)` event.\n    open var taskDidComplete: ((URLSession, URLSessionTask, Error?) -> Void)?\n\n    /// Closure called on the `urlSession(_:taskIsWaitingForConnectivity:)` event.\n    open var taskIsWaitingForConnectivity: ((URLSession, URLSessionTask) -> Void)?\n\n    /// Closure that receives the `urlSession(_:dataTask:didReceive:)` event.\n    open var dataTaskDidReceiveData: ((URLSession, URLSessionDataTask, Data) -> Void)?\n\n    /// Closure called on the `urlSession(_:dataTask:willCacheResponse:completionHandler:)` event.\n    open var dataTaskWillCacheResponse: ((URLSession, URLSessionDataTask, CachedURLResponse) -> Void)?\n\n    /// Closure called on the `urlSession(_:downloadTask:didFinishDownloadingTo:)` event.\n    open var downloadTaskDidFinishDownloadingToURL: ((URLSession, URLSessionDownloadTask, URL) -> Void)?\n\n    /// Closure called on the `urlSession(_:downloadTask:didWriteData:totalBytesWritten:totalBytesExpectedToWrite:)`\n    /// event.\n    open var downloadTaskDidWriteData: ((URLSession, URLSessionDownloadTask, Int64, Int64, Int64) -> Void)?\n\n    /// Closure called on the `urlSession(_:downloadTask:didResumeAtOffset:expectedTotalBytes:)` event.\n    open var downloadTaskDidResumeAtOffset: ((URLSession, URLSessionDownloadTask, Int64, Int64) -> Void)?\n\n    // MARK: - Request Events\n\n    /// Closure called on the `request(_:didCreateInitialURLRequest:)` event.\n    open var requestDidCreateInitialURLRequest: ((Request, URLRequest) -> Void)?\n\n    /// Closure called on the `request(_:didFailToCreateURLRequestWithError:)` event.\n    open var requestDidFailToCreateURLRequestWithError: ((Request, AFError) -> Void)?\n\n    /// Closure called on the `request(_:didAdaptInitialRequest:to:)` event.\n    open var requestDidAdaptInitialRequestToAdaptedRequest: ((Request, URLRequest, URLRequest) -> Void)?\n\n    /// Closure called on the `request(_:didFailToAdaptURLRequest:withError:)` event.\n    open var requestDidFailToAdaptURLRequestWithError: ((Request, URLRequest, AFError) -> Void)?\n\n    /// Closure called on the `request(_:didCreateURLRequest:)` event.\n    open var requestDidCreateURLRequest: ((Request, URLRequest) -> Void)?\n\n    /// Closure called on the `request(_:didCreateTask:)` event.\n    open var requestDidCreateTask: ((Request, URLSessionTask) -> Void)?\n\n    /// Closure called on the `request(_:didGatherMetrics:)` event.\n    open var requestDidGatherMetrics: ((Request, URLSessionTaskMetrics) -> Void)?\n\n    /// Closure called on the `request(_:didFailTask:earlyWithError:)` event.\n    open var requestDidFailTaskEarlyWithError: ((Request, URLSessionTask, AFError) -> Void)?\n\n    /// Closure called on the `request(_:didCompleteTask:with:)` event.\n    open var requestDidCompleteTaskWithError: ((Request, URLSessionTask, AFError?) -> Void)?\n\n    /// Closure called on the `requestIsRetrying(_:)` event.\n    open var requestIsRetrying: ((Request) -> Void)?\n\n    /// Closure called on the `requestDidFinish(_:)` event.\n    open var requestDidFinish: ((Request) -> Void)?\n\n    /// Closure called on the `requestDidResume(_:)` event.\n    open var requestDidResume: ((Request) -> Void)?\n\n    /// Closure called on the `request(_:didResumeTask:)` event.\n    open var requestDidResumeTask: ((Request, URLSessionTask) -> Void)?\n\n    /// Closure called on the `requestDidSuspend(_:)` event.\n    open var requestDidSuspend: ((Request) -> Void)?\n\n    /// Closure called on the `request(_:didSuspendTask:)` event.\n    open var requestDidSuspendTask: ((Request, URLSessionTask) -> Void)?\n\n    /// Closure called on the `requestDidCancel(_:)` event.\n    open var requestDidCancel: ((Request) -> Void)?\n\n    /// Closure called on the `request(_:didCancelTask:)` event.\n    open var requestDidCancelTask: ((Request, URLSessionTask) -> Void)?\n\n    /// Closure called on the `request(_:didValidateRequest:response:data:withResult:)` event.\n    open var requestDidValidateRequestResponseDataWithResult: ((DataRequest, URLRequest?, HTTPURLResponse, Data?, Request.ValidationResult) -> Void)?\n\n    /// Closure called on the `request(_:didParseResponse:)` event.\n    open var requestDidParseResponse: ((DataRequest, DataResponse<Data?, AFError>) -> Void)?\n\n    /// Closure called on the `request(_:didCreateUploadable:)` event.\n    open var requestDidCreateUploadable: ((UploadRequest, UploadRequest.Uploadable) -> Void)?\n\n    /// Closure called on the `request(_:didFailToCreateUploadableWithError:)` event.\n    open var requestDidFailToCreateUploadableWithError: ((UploadRequest, AFError) -> Void)?\n\n    /// Closure called on the `request(_:didProvideInputStream:)` event.\n    open var requestDidProvideInputStream: ((UploadRequest, InputStream) -> Void)?\n\n    /// Closure called on the `request(_:didFinishDownloadingUsing:with:)` event.\n    open var requestDidFinishDownloadingUsingTaskWithResult: ((DownloadRequest, URLSessionTask, Result<URL, AFError>) -> Void)?\n\n    /// Closure called on the `request(_:didCreateDestinationURL:)` event.\n    open var requestDidCreateDestinationURL: ((DownloadRequest, URL) -> Void)?\n\n    /// Closure called on the `request(_:didValidateRequest:response:temporaryURL:destinationURL:withResult:)` event.\n    open var requestDidValidateRequestResponseFileURLWithResult: ((DownloadRequest, URLRequest?, HTTPURLResponse, URL?, Request.ValidationResult) -> Void)?\n\n    /// Closure called on the `request(_:didParseResponse:)` event.\n    open var requestDidParseDownloadResponse: ((DownloadRequest, DownloadResponse<URL?, AFError>) -> Void)?\n\n    public let queue: DispatchQueue\n\n    /// Creates an instance using the provided queue.\n    ///\n    /// - Parameter queue: `DispatchQueue` on which events will fired. `.main` by default.\n    public init(queue: DispatchQueue = .main) {\n        self.queue = queue\n    }\n\n    open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {\n        sessionDidBecomeInvalidWithError?(session, error)\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didReceive challenge: URLAuthenticationChallenge) {\n        taskDidReceiveChallenge?(session, task, challenge)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         didSendBodyData bytesSent: Int64,\n                         totalBytesSent: Int64,\n                         totalBytesExpectedToSend: Int64) {\n        taskDidSendBodyData?(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend)\n    }\n\n    open func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) {\n        taskNeedNewBodyStream?(session, task)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         willPerformHTTPRedirection response: HTTPURLResponse,\n                         newRequest request: URLRequest) {\n        taskWillPerformHTTPRedirection?(session, task, response, request)\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {\n        taskDidFinishCollectingMetrics?(session, task, metrics)\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {\n        taskDidComplete?(session, task, error)\n    }\n\n    open func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {\n        taskIsWaitingForConnectivity?(session, task)\n    }\n\n    open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {\n        dataTaskDidReceiveData?(session, dataTask, data)\n    }\n\n    open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, willCacheResponse proposedResponse: CachedURLResponse) {\n        dataTaskWillCacheResponse?(session, dataTask, proposedResponse)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         downloadTask: URLSessionDownloadTask,\n                         didResumeAtOffset fileOffset: Int64,\n                         expectedTotalBytes: Int64) {\n        downloadTaskDidResumeAtOffset?(session, downloadTask, fileOffset, expectedTotalBytes)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         downloadTask: URLSessionDownloadTask,\n                         didWriteData bytesWritten: Int64,\n                         totalBytesWritten: Int64,\n                         totalBytesExpectedToWrite: Int64) {\n        downloadTaskDidWriteData?(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite)\n    }\n\n    open func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {\n        downloadTaskDidFinishDownloadingToURL?(session, downloadTask, location)\n    }\n\n    // MARK: Request Events\n\n    open func request(_ request: Request, didCreateInitialURLRequest urlRequest: URLRequest) {\n        requestDidCreateInitialURLRequest?(request, urlRequest)\n    }\n\n    open func request(_ request: Request, didFailToCreateURLRequestWithError error: AFError) {\n        requestDidFailToCreateURLRequestWithError?(request, error)\n    }\n\n    open func request(_ request: Request, didAdaptInitialRequest initialRequest: URLRequest, to adaptedRequest: URLRequest) {\n        requestDidAdaptInitialRequestToAdaptedRequest?(request, initialRequest, adaptedRequest)\n    }\n\n    open func request(_ request: Request, didFailToAdaptURLRequest initialRequest: URLRequest, withError error: AFError) {\n        requestDidFailToAdaptURLRequestWithError?(request, initialRequest, error)\n    }\n\n    open func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) {\n        requestDidCreateURLRequest?(request, urlRequest)\n    }\n\n    open func request(_ request: Request, didCreateTask task: URLSessionTask) {\n        requestDidCreateTask?(request, task)\n    }\n\n    open func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) {\n        requestDidGatherMetrics?(request, metrics)\n    }\n\n    open func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: AFError) {\n        requestDidFailTaskEarlyWithError?(request, task, error)\n    }\n\n    open func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?) {\n        requestDidCompleteTaskWithError?(request, task, error)\n    }\n\n    open func requestIsRetrying(_ request: Request) {\n        requestIsRetrying?(request)\n    }\n\n    open func requestDidFinish(_ request: Request) {\n        requestDidFinish?(request)\n    }\n\n    open func requestDidResume(_ request: Request) {\n        requestDidResume?(request)\n    }\n\n    public func request(_ request: Request, didResumeTask task: URLSessionTask) {\n        requestDidResumeTask?(request, task)\n    }\n\n    open func requestDidSuspend(_ request: Request) {\n        requestDidSuspend?(request)\n    }\n\n    public func request(_ request: Request, didSuspendTask task: URLSessionTask) {\n        requestDidSuspendTask?(request, task)\n    }\n\n    open func requestDidCancel(_ request: Request) {\n        requestDidCancel?(request)\n    }\n\n    public func request(_ request: Request, didCancelTask task: URLSessionTask) {\n        requestDidCancelTask?(request, task)\n    }\n\n    open func request(_ request: DataRequest,\n                      didValidateRequest urlRequest: URLRequest?,\n                      response: HTTPURLResponse,\n                      data: Data?,\n                      withResult result: Request.ValidationResult) {\n        requestDidValidateRequestResponseDataWithResult?(request, urlRequest, response, data, result)\n    }\n\n    open func request(_ request: DataRequest, didParseResponse response: DataResponse<Data?, AFError>) {\n        requestDidParseResponse?(request, response)\n    }\n\n    open func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) {\n        requestDidCreateUploadable?(request, uploadable)\n    }\n\n    open func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: AFError) {\n        requestDidFailToCreateUploadableWithError?(request, error)\n    }\n\n    open func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) {\n        requestDidProvideInputStream?(request, stream)\n    }\n\n    open func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: Result<URL, AFError>) {\n        requestDidFinishDownloadingUsingTaskWithResult?(request, task, result)\n    }\n\n    open func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) {\n        requestDidCreateDestinationURL?(request, url)\n    }\n\n    open func request(_ request: DownloadRequest,\n                      didValidateRequest urlRequest: URLRequest?,\n                      response: HTTPURLResponse,\n                      fileURL: URL?,\n                      withResult result: Request.ValidationResult) {\n        requestDidValidateRequestResponseFileURLWithResult?(request,\n                                                            urlRequest,\n                                                            response,\n                                                            fileURL,\n                                                            result)\n    }\n\n    open func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse<URL?, AFError>) {\n        requestDidParseDownloadResponse?(request, response)\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/HTTPHeaders.swift",
    "content": "//\n//  HTTPHeaders.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// An order-preserving and case-insensitive representation of HTTP headers.\npublic struct HTTPHeaders {\n    private var headers: [HTTPHeader] = []\n\n    /// Creates an empty instance.\n    public init() {}\n\n    /// Creates an instance from an array of `HTTPHeader`s. Duplicate case-insensitive names are collapsed into the last\n    /// name and value encountered.\n    public init(_ headers: [HTTPHeader]) {\n        self.init()\n\n        headers.forEach { update($0) }\n    }\n\n    /// Creates an instance from a `[String: String]`. Duplicate case-insensitive names are collapsed into the last name\n    /// and value encountered.\n    public init(_ dictionary: [String: String]) {\n        self.init()\n\n        dictionary.forEach { update(HTTPHeader(name: $0.key, value: $0.value)) }\n    }\n\n    /// Case-insensitively updates or appends an `HTTPHeader` into the instance using the provided `name` and `value`.\n    ///\n    /// - Parameters:\n    ///   - name:  The `HTTPHeader` name.\n    ///   - value: The `HTTPHeader value.\n    public mutating func add(name: String, value: String) {\n        update(HTTPHeader(name: name, value: value))\n    }\n\n    /// Case-insensitively updates or appends the provided `HTTPHeader` into the instance.\n    ///\n    /// - Parameter header: The `HTTPHeader` to update or append.\n    public mutating func add(_ header: HTTPHeader) {\n        update(header)\n    }\n\n    /// Case-insensitively updates or appends an `HTTPHeader` into the instance using the provided `name` and `value`.\n    ///\n    /// - Parameters:\n    ///   - name:  The `HTTPHeader` name.\n    ///   - value: The `HTTPHeader value.\n    public mutating func update(name: String, value: String) {\n        update(HTTPHeader(name: name, value: value))\n    }\n\n    /// Case-insensitively updates or appends the provided `HTTPHeader` into the instance.\n    ///\n    /// - Parameter header: The `HTTPHeader` to update or append.\n    public mutating func update(_ header: HTTPHeader) {\n        guard let index = headers.index(of: header.name) else {\n            headers.append(header)\n            return\n        }\n\n        headers.replaceSubrange(index...index, with: [header])\n    }\n\n    /// Case-insensitively removes an `HTTPHeader`, if it exists, from the instance.\n    ///\n    /// - Parameter name: The name of the `HTTPHeader` to remove.\n    public mutating func remove(name: String) {\n        guard let index = headers.index(of: name) else { return }\n\n        headers.remove(at: index)\n    }\n\n    /// Sort the current instance by header name.\n    public mutating func sort() {\n        headers.sort { $0.name < $1.name }\n    }\n\n    /// Returns an instance sorted by header name.\n    ///\n    /// - Returns: A copy of the current instance sorted by name.\n    public func sorted() -> HTTPHeaders {\n        return HTTPHeaders(headers.sorted { $0.name < $1.name })\n    }\n\n    /// Case-insensitively find a header's value by name.\n    ///\n    /// - Parameter name: The name of the header to search for, case-insensitively.\n    ///\n    /// - Returns:        The value of header, if it exists.\n    public func value(for name: String) -> String? {\n        guard let index = headers.index(of: name) else { return nil }\n\n        return headers[index].value\n    }\n\n    /// Case-insensitively access the header with the given name.\n    ///\n    /// - Parameter name: The name of the header.\n    public subscript(_ name: String) -> String? {\n        get { return value(for: name) }\n        set {\n            if let value = newValue {\n                update(name: name, value: value)\n            } else {\n                remove(name: name)\n            }\n        }\n    }\n\n    /// The dictionary representation of all headers.\n    ///\n    /// This representation does not preserve the current order of the instance.\n    public var dictionary: [String: String] {\n        let namesAndValues = headers.map { ($0.name, $0.value) }\n\n        return Dictionary(namesAndValues, uniquingKeysWith: { _, last in last })\n    }\n}\n\nextension HTTPHeaders: ExpressibleByDictionaryLiteral {\n    public init(dictionaryLiteral elements: (String, String)...) {\n        self.init()\n\n        elements.forEach { update(name: $0.0, value: $0.1) }\n    }\n}\n\nextension HTTPHeaders: ExpressibleByArrayLiteral {\n    public init(arrayLiteral elements: HTTPHeader...) {\n        self.init(elements)\n    }\n}\n\nextension HTTPHeaders: Sequence {\n    public func makeIterator() -> IndexingIterator<[HTTPHeader]> {\n        return headers.makeIterator()\n    }\n}\n\nextension HTTPHeaders: Collection {\n    public var startIndex: Int {\n        return headers.startIndex\n    }\n\n    public var endIndex: Int {\n        return headers.endIndex\n    }\n\n    public subscript(position: Int) -> HTTPHeader {\n        return headers[position]\n    }\n\n    public func index(after i: Int) -> Int {\n        return headers.index(after: i)\n    }\n}\n\nextension HTTPHeaders: CustomStringConvertible {\n    public var description: String {\n        return headers.map { $0.description }\n            .joined(separator: \"\\n\")\n    }\n}\n\n// MARK: - HTTPHeader\n\n/// A representation of a single HTTP header's name / value pair.\npublic struct HTTPHeader: Hashable {\n    /// Name of the header.\n    public let name: String\n\n    /// Value of the header.\n    public let value: String\n\n    /// Creates an instance from the given `name` and `value`.\n    ///\n    /// - Parameters:\n    ///   - name:  The name of the header.\n    ///   - value: The value of the header.\n    public init(name: String, value: String) {\n        self.name = name\n        self.value = value\n    }\n}\n\nextension HTTPHeader: CustomStringConvertible {\n    public var description: String {\n        return \"\\(name): \\(value)\"\n    }\n}\n\nextension HTTPHeader {\n    /// Returns an `Accept` header.\n    ///\n    /// - Parameter value: The `Accept` value.\n    /// - Returns:         The header.\n    public static func accept(_ value: String) -> HTTPHeader {\n        return HTTPHeader(name: \"Accept\", value: value)\n    }\n\n    /// Returns an `Accept-Charset` header.\n    ///\n    /// - Parameter value: The `Accept-Charset` value.\n    /// - Returns:         The header.\n    public static func acceptCharset(_ value: String) -> HTTPHeader {\n        return HTTPHeader(name: \"Accept-Charset\", value: value)\n    }\n\n    /// Returns an `Accept-Language` header.\n    ///\n    /// Alamofire offers a default Accept-Language header that accumulates and encodes the system's preferred languages.\n    /// Use `HTTPHeader.defaultAcceptLanguage`.\n    ///\n    /// - Parameter value: The `Accept-Language` value.\n    ///\n    /// - Returns:         The header.\n    public static func acceptLanguage(_ value: String) -> HTTPHeader {\n        return HTTPHeader(name: \"Accept-Language\", value: value)\n    }\n\n    /// Returns an `Accept-Encoding` header.\n    ///\n    /// Alamofire offers a default accept encoding value that provides the most common values. Use\n    /// `HTTPHeader.defaultAcceptEncoding`.\n    ///\n    /// - Parameter value: The `Accept-Encoding` value.\n    ///\n    /// - Returns:         The header\n    public static func acceptEncoding(_ value: String) -> HTTPHeader {\n        return HTTPHeader(name: \"Accept-Encoding\", value: value)\n    }\n\n    /// Returns a `Basic` `Authorization` header using the `username` and `password` provided.\n    ///\n    /// - Parameters:\n    ///   - username: The username of the header.\n    ///   - password: The password of the header.\n    ///\n    /// - Returns:    The header.\n    public static func authorization(username: String, password: String) -> HTTPHeader {\n        let credential = Data(\"\\(username):\\(password)\".utf8).base64EncodedString()\n\n        return authorization(\"Basic \\(credential)\")\n    }\n\n    /// Returns a `Bearer` `Authorization` header using the `bearerToken` provided\n    ///\n    /// - Parameter bearerToken: The bearer token.\n    ///\n    /// - Returns:               The header.\n    public static func authorization(bearerToken: String) -> HTTPHeader {\n        return authorization(\"Bearer \\(bearerToken)\")\n    }\n\n    /// Returns an `Authorization` header.\n    ///\n    /// Alamofire provides built-in methods to produce `Authorization` headers. For a Basic `Authorization` header use\n    /// `HTTPHeader.authorization(username:password:)`. For a Bearer `Authorization` header, use\n    /// `HTTPHeader.authorization(bearerToken:)`.\n    ///\n    /// - Parameter value: The `Authorization` value.\n    ///\n    /// - Returns:         The header.\n    public static func authorization(_ value: String) -> HTTPHeader {\n        return HTTPHeader(name: \"Authorization\", value: value)\n    }\n\n    /// Returns a `Content-Disposition` header.\n    ///\n    /// - Parameter value: The `Content-Disposition` value.\n    ///\n    /// - Returns:         The header.\n    public static func contentDisposition(_ value: String) -> HTTPHeader {\n        return HTTPHeader(name: \"Content-Disposition\", value: value)\n    }\n\n    /// Returns a `Content-Type` header.\n    ///\n    /// All Alamofire `ParameterEncoding`s and `ParameterEncoder`s set the `Content-Type` of the request, so it may not be necessary to manually\n    /// set this value.\n    ///\n    /// - Parameter value: The `Content-Type` value.\n    ///\n    /// - Returns:         The header.\n    public static func contentType(_ value: String) -> HTTPHeader {\n        return HTTPHeader(name: \"Content-Type\", value: value)\n    }\n\n    /// Returns a `User-Agent` header.\n    ///\n    /// - Parameter value: The `User-Agent` value.\n    ///\n    /// - Returns:         The header.\n    public static func userAgent(_ value: String) -> HTTPHeader {\n        return HTTPHeader(name: \"User-Agent\", value: value)\n    }\n}\n\nextension Array where Element == HTTPHeader {\n    /// Case-insensitively finds the index of an `HTTPHeader` with the provided name, if it exists.\n    func index(of name: String) -> Int? {\n        let lowercasedName = name.lowercased()\n        return firstIndex { $0.name.lowercased() == lowercasedName }\n    }\n}\n\n// MARK: - Defaults\n\npublic extension HTTPHeaders {\n    /// The default set of `HTTPHeaders` used by Alamofire. Includes `Accept-Encoding`, `Accept-Language`, and\n    /// `User-Agent`.\n    static let `default`: HTTPHeaders = [.defaultAcceptEncoding,\n                                         .defaultAcceptLanguage,\n                                         .defaultUserAgent]\n}\n\nextension HTTPHeader {\n    /// Returns Alamofire's default `Accept-Encoding` header, appropriate for the encodings supported by particular OS\n    /// versions.\n    ///\n    /// See the [Accept-Encoding HTTP header documentation](https://tools.ietf.org/html/rfc7230#section-4.2.3) .\n    public static let defaultAcceptEncoding: HTTPHeader = {\n        let encodings: [String]\n        if #available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *) {\n            encodings = [\"br\", \"gzip\", \"deflate\"]\n        } else {\n            encodings = [\"gzip\", \"deflate\"]\n        }\n\n        return .acceptEncoding(encodings.qualityEncoded())\n    }()\n\n    /// Returns Alamofire's default `Accept-Language` header, generated by querying `Locale` for the user's\n    /// `preferredLanguages`.\n    ///\n    /// See the [Accept-Language HTTP header documentation](https://tools.ietf.org/html/rfc7231#section-5.3.5).\n    public static let defaultAcceptLanguage: HTTPHeader = {\n        .acceptLanguage(Locale.preferredLanguages.prefix(6).qualityEncoded())\n    }()\n\n    /// Returns Alamofire's default `User-Agent` header.\n    ///\n    /// See the [User-Agent header documentation](https://tools.ietf.org/html/rfc7231#section-5.5.3).\n    ///\n    /// Example: `iOS Example/1.0 (org.alamofire.iOS-Example; build:1; iOS 13.0.0) Alamofire/5.0.0`\n    public static let defaultUserAgent: HTTPHeader = {\n        let userAgent: String = {\n            if let info = Bundle.main.infoDictionary {\n                let executable = info[kCFBundleExecutableKey as String] as? String ?? \"Unknown\"\n                let bundle = info[kCFBundleIdentifierKey as String] as? String ?? \"Unknown\"\n                let appVersion = info[\"CFBundleShortVersionString\"] as? String ?? \"Unknown\"\n                let appBuild = info[kCFBundleVersionKey as String] as? String ?? \"Unknown\"\n\n                let osNameVersion: String = {\n                    let version = ProcessInfo.processInfo.operatingSystemVersion\n                    let versionString = \"\\(version.majorVersion).\\(version.minorVersion).\\(version.patchVersion)\"\n                    // swiftformat:disable indent\n                    let osName: String = {\n                    #if os(iOS)\n                        return \"iOS\"\n                    #elseif os(watchOS)\n                        return \"watchOS\"\n                    #elseif os(tvOS)\n                        return \"tvOS\"\n                    #elseif os(macOS)\n                        return \"macOS\"\n                    #elseif os(Linux)\n                        return \"Linux\"\n                    #else\n                        return \"Unknown\"\n                    #endif\n                    }()\n                    // swiftformat:enable indent\n\n                    return \"\\(osName) \\(versionString)\"\n                }()\n\n                let alamofireVersion = \"Alamofire/\\(version)\"\n\n                return \"\\(executable)/\\(appVersion) (\\(bundle); build:\\(appBuild); \\(osNameVersion)) \\(alamofireVersion)\"\n            }\n\n            return \"Alamofire\"\n        }()\n\n        return .userAgent(userAgent)\n    }()\n}\n\nextension Collection where Element == String {\n    func qualityEncoded() -> String {\n        return enumerated().map { index, encoding in\n            let quality = 1.0 - (Double(index) * 0.1)\n            return \"\\(encoding);q=\\(quality)\"\n        }.joined(separator: \", \")\n    }\n}\n\n// MARK: - System Type Extensions\n\nextension URLRequest {\n    /// Returns `allHTTPHeaderFields` as `HTTPHeaders`.\n    public var headers: HTTPHeaders {\n        get { return allHTTPHeaderFields.map(HTTPHeaders.init) ?? HTTPHeaders() }\n        set { allHTTPHeaderFields = newValue.dictionary }\n    }\n}\n\nextension HTTPURLResponse {\n    /// Returns `allHeaderFields` as `HTTPHeaders`.\n    public var headers: HTTPHeaders {\n        return (allHeaderFields as? [String: String]).map(HTTPHeaders.init) ?? HTTPHeaders()\n    }\n}\n\npublic extension URLSessionConfiguration {\n    /// Returns `httpAdditionalHeaders` as `HTTPHeaders`.\n    var headers: HTTPHeaders {\n        get { return (httpAdditionalHeaders as? [String: String]).map(HTTPHeaders.init) ?? HTTPHeaders() }\n        set { httpAdditionalHeaders = newValue.dictionary }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/HTTPMethod.swift",
    "content": "//\n//  HTTPMethod.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\n/// Type representing HTTP methods. Raw `String` value is stored and compared case-sensitively, so\n/// `HTTPMethod.get != HTTPMethod(rawValue: \"get\")`.\n///\n/// See https://tools.ietf.org/html/rfc7231#section-4.3\npublic struct HTTPMethod: RawRepresentable, Equatable, Hashable {\n    /// `CONNECT` method.\n    public static let connect = HTTPMethod(rawValue: \"CONNECT\")\n    /// `DELETE` method.\n    public static let delete = HTTPMethod(rawValue: \"DELETE\")\n    /// `GET` method.\n    public static let get = HTTPMethod(rawValue: \"GET\")\n    /// `HEAD` method.\n    public static let head = HTTPMethod(rawValue: \"HEAD\")\n    /// `OPTIONS` method.\n    public static let options = HTTPMethod(rawValue: \"OPTIONS\")\n    /// `PATCH` method.\n    public static let patch = HTTPMethod(rawValue: \"PATCH\")\n    /// `POST` method.\n    public static let post = HTTPMethod(rawValue: \"POST\")\n    /// `PUT` method.\n    public static let put = HTTPMethod(rawValue: \"PUT\")\n    /// `TRACE` method.\n    public static let trace = HTTPMethod(rawValue: \"TRACE\")\n\n    public let rawValue: String\n\n    public init(rawValue: String) {\n        self.rawValue = rawValue\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/MultipartFormData.swift",
    "content": "//\n//  MultipartFormData.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n#if os(iOS) || os(watchOS) || os(tvOS)\nimport MobileCoreServices\n#elseif os(macOS)\nimport CoreServices\n#endif\n\n/// Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode\n/// multipart form data. The first way is to encode the data directly in memory. This is very efficient, but can lead\n/// to memory issues if the dataset is too large. The second way is designed for larger datasets and will write all the\n/// data to a single file on disk with all the proper boundary segmentation. The second approach MUST be used for\n/// larger datasets such as video content, otherwise your app may run out of memory when trying to encode the dataset.\n///\n/// For more information on `multipart/form-data` in general, please refer to the RFC-2388 and RFC-2045 specs as well\n/// and the w3 form documentation.\n///\n/// - https://www.ietf.org/rfc/rfc2388.txt\n/// - https://www.ietf.org/rfc/rfc2045.txt\n/// - https://www.w3.org/TR/html401/interact/forms.html#h-17.13\nopen class MultipartFormData {\n    // MARK: - Helper Types\n\n    struct EncodingCharacters {\n        static let crlf = \"\\r\\n\"\n    }\n\n    struct BoundaryGenerator {\n        enum BoundaryType {\n            case initial, encapsulated, final\n        }\n\n        static func randomBoundary() -> String {\n            return String(format: \"alamofire.boundary.%08x%08x\", arc4random(), arc4random())\n        }\n\n        static func boundaryData(forBoundaryType boundaryType: BoundaryType, boundary: String) -> Data {\n            let boundaryText: String\n\n            switch boundaryType {\n            case .initial:\n                boundaryText = \"--\\(boundary)\\(EncodingCharacters.crlf)\"\n            case .encapsulated:\n                boundaryText = \"\\(EncodingCharacters.crlf)--\\(boundary)\\(EncodingCharacters.crlf)\"\n            case .final:\n                boundaryText = \"\\(EncodingCharacters.crlf)--\\(boundary)--\\(EncodingCharacters.crlf)\"\n            }\n\n            return Data(boundaryText.utf8)\n        }\n    }\n\n    class BodyPart {\n        let headers: HTTPHeaders\n        let bodyStream: InputStream\n        let bodyContentLength: UInt64\n        var hasInitialBoundary = false\n        var hasFinalBoundary = false\n\n        init(headers: HTTPHeaders, bodyStream: InputStream, bodyContentLength: UInt64) {\n            self.headers = headers\n            self.bodyStream = bodyStream\n            self.bodyContentLength = bodyContentLength\n        }\n    }\n\n    // MARK: - Properties\n\n    /// Default memory threshold used when encoding `MultipartFormData`, in bytes.\n    public static let encodingMemoryThreshold: UInt64 = 10_000_000\n\n    /// The `Content-Type` header value containing the boundary used to generate the `multipart/form-data`.\n    open lazy var contentType: String = \"multipart/form-data; boundary=\\(self.boundary)\"\n\n    /// The content length of all body parts used to generate the `multipart/form-data` not including the boundaries.\n    public var contentLength: UInt64 { return bodyParts.reduce(0) { $0 + $1.bodyContentLength } }\n\n    /// The boundary used to separate the body parts in the encoded form data.\n    public let boundary: String\n\n    let fileManager: FileManager\n\n    private var bodyParts: [BodyPart]\n    private var bodyPartError: AFError?\n    private let streamBufferSize: Int\n\n    // MARK: - Lifecycle\n\n    /// Creates an instance.\n    ///\n    /// - Parameters:\n    ///   - fileManager: `FileManager` to use for file operations, if needed.\n    ///   - boundary: Boundary `String` used to separate body parts.\n    public init(fileManager: FileManager = .default, boundary: String? = nil) {\n        self.fileManager = fileManager\n        self.boundary = boundary ?? BoundaryGenerator.randomBoundary()\n        bodyParts = []\n\n        //\n        // The optimal read/write buffer size in bytes for input and output streams is 1024 (1KB). For more\n        // information, please refer to the following article:\n        //   - https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Streams/Articles/ReadingInputStreams.html\n        //\n        streamBufferSize = 1024\n    }\n\n    // MARK: - Body Parts\n\n    /// Creates a body part from the data and appends it to the instance.\n    ///\n    /// The body part data will be encoded using the following format:\n    ///\n    /// - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header)\n    /// - `Content-Type: #{mimeType}` (HTTP Header)\n    /// - Encoded file data\n    /// - Multipart form boundary\n    ///\n    /// - Parameters:\n    ///   - data:     `Data` to encoding into the instance.\n    ///   - name:     Name to associate with the `Data` in the `Content-Disposition` HTTP header.\n    ///   - fileName: Filename to associate with the `Data` in the `Content-Disposition` HTTP header.\n    ///   - mimeType: MIME type to associate with the data in the `Content-Type` HTTP header.\n    public func append(_ data: Data, withName name: String, fileName: String? = nil, mimeType: String? = nil) {\n        let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)\n        let stream = InputStream(data: data)\n        let length = UInt64(data.count)\n\n        append(stream, withLength: length, headers: headers)\n    }\n\n    /// Creates a body part from the file and appends it to the instance.\n    ///\n    /// The body part data will be encoded using the following format:\n    ///\n    /// - `Content-Disposition: form-data; name=#{name}; filename=#{generated filename}` (HTTP Header)\n    /// - `Content-Type: #{generated mimeType}` (HTTP Header)\n    /// - Encoded file data\n    /// - Multipart form boundary\n    ///\n    /// The filename in the `Content-Disposition` HTTP header is generated from the last path component of the\n    /// `fileURL`. The `Content-Type` HTTP header MIME type is generated by mapping the `fileURL` extension to the\n    /// system associated MIME type.\n    ///\n    /// - Parameters:\n    ///   - fileURL: `URL` of the file whose content will be encoded into the instance.\n    ///   - name:    Name to associate with the file content in the `Content-Disposition` HTTP header.\n    public func append(_ fileURL: URL, withName name: String) {\n        let fileName = fileURL.lastPathComponent\n        let pathExtension = fileURL.pathExtension\n\n        if !fileName.isEmpty && !pathExtension.isEmpty {\n            let mime = mimeType(forPathExtension: pathExtension)\n            append(fileURL, withName: name, fileName: fileName, mimeType: mime)\n        } else {\n            setBodyPartError(withReason: .bodyPartFilenameInvalid(in: fileURL))\n        }\n    }\n\n    /// Creates a body part from the file and appends it to the instance.\n    ///\n    /// The body part data will be encoded using the following format:\n    ///\n    /// - Content-Disposition: form-data; name=#{name}; filename=#{filename} (HTTP Header)\n    /// - Content-Type: #{mimeType} (HTTP Header)\n    /// - Encoded file data\n    /// - Multipart form boundary\n    ///\n    /// - Parameters:\n    ///   - fileURL:  `URL` of the file whose content will be encoded into the instance.\n    ///   - name:     Name to associate with the file content in the `Content-Disposition` HTTP header.\n    ///   - fileName: Filename to associate with the file content in the `Content-Disposition` HTTP header.\n    ///   - mimeType: MIME type to associate with the file content in the `Content-Type` HTTP header.\n    public func append(_ fileURL: URL, withName name: String, fileName: String, mimeType: String) {\n        let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)\n\n        //============================================================\n        //                 Check 1 - is file URL?\n        //============================================================\n\n        guard fileURL.isFileURL else {\n            setBodyPartError(withReason: .bodyPartURLInvalid(url: fileURL))\n            return\n        }\n\n        //============================================================\n        //              Check 2 - is file URL reachable?\n        //============================================================\n\n        do {\n            let isReachable = try fileURL.checkPromisedItemIsReachable()\n            guard isReachable else {\n                setBodyPartError(withReason: .bodyPartFileNotReachable(at: fileURL))\n                return\n            }\n        } catch {\n            setBodyPartError(withReason: .bodyPartFileNotReachableWithError(atURL: fileURL, error: error))\n            return\n        }\n\n        //============================================================\n        //            Check 3 - is file URL a directory?\n        //============================================================\n\n        var isDirectory: ObjCBool = false\n        let path = fileURL.path\n\n        guard fileManager.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory.boolValue else {\n            setBodyPartError(withReason: .bodyPartFileIsDirectory(at: fileURL))\n            return\n        }\n\n        //============================================================\n        //          Check 4 - can the file size be extracted?\n        //============================================================\n\n        let bodyContentLength: UInt64\n\n        do {\n            guard let fileSize = try fileManager.attributesOfItem(atPath: path)[.size] as? NSNumber else {\n                setBodyPartError(withReason: .bodyPartFileSizeNotAvailable(at: fileURL))\n                return\n            }\n\n            bodyContentLength = fileSize.uint64Value\n        } catch {\n            setBodyPartError(withReason: .bodyPartFileSizeQueryFailedWithError(forURL: fileURL, error: error))\n            return\n        }\n\n        //============================================================\n        //       Check 5 - can a stream be created from file URL?\n        //============================================================\n\n        guard let stream = InputStream(url: fileURL) else {\n            setBodyPartError(withReason: .bodyPartInputStreamCreationFailed(for: fileURL))\n            return\n        }\n\n        append(stream, withLength: bodyContentLength, headers: headers)\n    }\n\n    /// Creates a body part from the stream and appends it to the instance.\n    ///\n    /// The body part data will be encoded using the following format:\n    ///\n    /// - `Content-Disposition: form-data; name=#{name}; filename=#{filename}` (HTTP Header)\n    /// - `Content-Type: #{mimeType}` (HTTP Header)\n    /// - Encoded stream data\n    /// - Multipart form boundary\n    ///\n    /// - Parameters:\n    ///   - stream:   `InputStream` to encode into the instance.\n    ///   - length:   Length, in bytes, of the stream.\n    ///   - name:     Name to associate with the stream content in the `Content-Disposition` HTTP header.\n    ///   - fileName: Filename to associate with the stream content in the `Content-Disposition` HTTP header.\n    ///   - mimeType: MIME type to associate with the stream content in the `Content-Type` HTTP header.\n    public func append(_ stream: InputStream,\n                       withLength length: UInt64,\n                       name: String,\n                       fileName: String,\n                       mimeType: String) {\n        let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)\n        append(stream, withLength: length, headers: headers)\n    }\n\n    /// Creates a body part with the stream, length, and headers and appends it to the instance.\n    ///\n    /// The body part data will be encoded using the following format:\n    ///\n    /// - HTTP headers\n    /// - Encoded stream data\n    /// - Multipart form boundary\n    ///\n    /// - Parameters:\n    ///   - stream:  `InputStream` to encode into the instance.\n    ///   - length:  Length, in bytes, of the stream.\n    ///   - headers: `HTTPHeaders` for the body part.\n    public func append(_ stream: InputStream, withLength length: UInt64, headers: HTTPHeaders) {\n        let bodyPart = BodyPart(headers: headers, bodyStream: stream, bodyContentLength: length)\n        bodyParts.append(bodyPart)\n    }\n\n    // MARK: - Data Encoding\n\n    /// Encodes all appended body parts into a single `Data` value.\n    ///\n    /// - Note: This method will load all the appended body parts into memory all at the same time. This method should\n    ///         only be used when the encoded data will have a small memory footprint. For large data cases, please use\n    ///         the `writeEncodedData(to:))` method.\n    ///\n    /// - Returns: The encoded `Data`, if encoding is successful.\n    /// - Throws:  An `AFError` if encoding encounters an error.\n    public func encode() throws -> Data {\n        if let bodyPartError = bodyPartError {\n            throw bodyPartError\n        }\n\n        var encoded = Data()\n\n        bodyParts.first?.hasInitialBoundary = true\n        bodyParts.last?.hasFinalBoundary = true\n\n        for bodyPart in bodyParts {\n            let encodedData = try encode(bodyPart)\n            encoded.append(encodedData)\n        }\n\n        return encoded\n    }\n\n    /// Writes all appended body parts to the given file `URL`.\n    ///\n    /// This process is facilitated by reading and writing with input and output streams, respectively. Thus,\n    /// this approach is very memory efficient and should be used for large body part data.\n    ///\n    /// - Parameter fileURL: File `URL` to which to write the form data.\n    /// - Throws:            An `AFError` if encoding encounters an error.\n    public func writeEncodedData(to fileURL: URL) throws {\n        if let bodyPartError = bodyPartError {\n            throw bodyPartError\n        }\n\n        if fileManager.fileExists(atPath: fileURL.path) {\n            throw AFError.multipartEncodingFailed(reason: .outputStreamFileAlreadyExists(at: fileURL))\n        } else if !fileURL.isFileURL {\n            throw AFError.multipartEncodingFailed(reason: .outputStreamURLInvalid(url: fileURL))\n        }\n\n        guard let outputStream = OutputStream(url: fileURL, append: false) else {\n            throw AFError.multipartEncodingFailed(reason: .outputStreamCreationFailed(for: fileURL))\n        }\n\n        outputStream.open()\n        defer { outputStream.close() }\n\n        bodyParts.first?.hasInitialBoundary = true\n        bodyParts.last?.hasFinalBoundary = true\n\n        for bodyPart in bodyParts {\n            try write(bodyPart, to: outputStream)\n        }\n    }\n\n    // MARK: - Private - Body Part Encoding\n\n    private func encode(_ bodyPart: BodyPart) throws -> Data {\n        var encoded = Data()\n\n        let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData()\n        encoded.append(initialData)\n\n        let headerData = encodeHeaders(for: bodyPart)\n        encoded.append(headerData)\n\n        let bodyStreamData = try encodeBodyStream(for: bodyPart)\n        encoded.append(bodyStreamData)\n\n        if bodyPart.hasFinalBoundary {\n            encoded.append(finalBoundaryData())\n        }\n\n        return encoded\n    }\n\n    private func encodeHeaders(for bodyPart: BodyPart) -> Data {\n        let headerText = bodyPart.headers.map { \"\\($0.name): \\($0.value)\\(EncodingCharacters.crlf)\" }\n            .joined()\n            + EncodingCharacters.crlf\n\n        return Data(headerText.utf8)\n    }\n\n    private func encodeBodyStream(for bodyPart: BodyPart) throws -> Data {\n        let inputStream = bodyPart.bodyStream\n        inputStream.open()\n        defer { inputStream.close() }\n\n        var encoded = Data()\n\n        while inputStream.hasBytesAvailable {\n            var buffer = [UInt8](repeating: 0, count: streamBufferSize)\n            let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize)\n\n            if let error = inputStream.streamError {\n                throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: error))\n            }\n\n            if bytesRead > 0 {\n                encoded.append(buffer, count: bytesRead)\n            } else {\n                break\n            }\n        }\n\n        return encoded\n    }\n\n    // MARK: - Private - Writing Body Part to Output Stream\n\n    private func write(_ bodyPart: BodyPart, to outputStream: OutputStream) throws {\n        try writeInitialBoundaryData(for: bodyPart, to: outputStream)\n        try writeHeaderData(for: bodyPart, to: outputStream)\n        try writeBodyStream(for: bodyPart, to: outputStream)\n        try writeFinalBoundaryData(for: bodyPart, to: outputStream)\n    }\n\n    private func writeInitialBoundaryData(for bodyPart: BodyPart, to outputStream: OutputStream) throws {\n        let initialData = bodyPart.hasInitialBoundary ? initialBoundaryData() : encapsulatedBoundaryData()\n        return try write(initialData, to: outputStream)\n    }\n\n    private func writeHeaderData(for bodyPart: BodyPart, to outputStream: OutputStream) throws {\n        let headerData = encodeHeaders(for: bodyPart)\n        return try write(headerData, to: outputStream)\n    }\n\n    private func writeBodyStream(for bodyPart: BodyPart, to outputStream: OutputStream) throws {\n        let inputStream = bodyPart.bodyStream\n\n        inputStream.open()\n        defer { inputStream.close() }\n\n        while inputStream.hasBytesAvailable {\n            var buffer = [UInt8](repeating: 0, count: streamBufferSize)\n            let bytesRead = inputStream.read(&buffer, maxLength: streamBufferSize)\n\n            if let streamError = inputStream.streamError {\n                throw AFError.multipartEncodingFailed(reason: .inputStreamReadFailed(error: streamError))\n            }\n\n            if bytesRead > 0 {\n                if buffer.count != bytesRead {\n                    buffer = Array(buffer[0..<bytesRead])\n                }\n\n                try write(&buffer, to: outputStream)\n            } else {\n                break\n            }\n        }\n    }\n\n    private func writeFinalBoundaryData(for bodyPart: BodyPart, to outputStream: OutputStream) throws {\n        if bodyPart.hasFinalBoundary {\n            return try write(finalBoundaryData(), to: outputStream)\n        }\n    }\n\n    // MARK: - Private - Writing Buffered Data to Output Stream\n\n    private func write(_ data: Data, to outputStream: OutputStream) throws {\n        var buffer = [UInt8](repeating: 0, count: data.count)\n        data.copyBytes(to: &buffer, count: data.count)\n\n        return try write(&buffer, to: outputStream)\n    }\n\n    private func write(_ buffer: inout [UInt8], to outputStream: OutputStream) throws {\n        var bytesToWrite = buffer.count\n\n        while bytesToWrite > 0, outputStream.hasSpaceAvailable {\n            let bytesWritten = outputStream.write(buffer, maxLength: bytesToWrite)\n\n            if let error = outputStream.streamError {\n                throw AFError.multipartEncodingFailed(reason: .outputStreamWriteFailed(error: error))\n            }\n\n            bytesToWrite -= bytesWritten\n\n            if bytesToWrite > 0 {\n                buffer = Array(buffer[bytesWritten..<buffer.count])\n            }\n        }\n    }\n\n    // MARK: - Private - Mime Type\n\n    private func mimeType(forPathExtension pathExtension: String) -> String {\n        if\n            let id = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as CFString, nil)?.takeRetainedValue(),\n            let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?.takeRetainedValue() {\n            return contentType as String\n        }\n\n        return \"application/octet-stream\"\n    }\n\n    // MARK: - Private - Content Headers\n\n    private func contentHeaders(withName name: String, fileName: String? = nil, mimeType: String? = nil) -> HTTPHeaders {\n        var disposition = \"form-data; name=\\\"\\(name)\\\"\"\n        if let fileName = fileName { disposition += \"; filename=\\\"\\(fileName)\\\"\" }\n\n        var headers: HTTPHeaders = [.contentDisposition(disposition)]\n        if let mimeType = mimeType { headers.add(.contentType(mimeType)) }\n\n        return headers\n    }\n\n    // MARK: - Private - Boundary Encoding\n\n    private func initialBoundaryData() -> Data {\n        return BoundaryGenerator.boundaryData(forBoundaryType: .initial, boundary: boundary)\n    }\n\n    private func encapsulatedBoundaryData() -> Data {\n        return BoundaryGenerator.boundaryData(forBoundaryType: .encapsulated, boundary: boundary)\n    }\n\n    private func finalBoundaryData() -> Data {\n        return BoundaryGenerator.boundaryData(forBoundaryType: .final, boundary: boundary)\n    }\n\n    // MARK: - Private - Errors\n\n    private func setBodyPartError(withReason reason: AFError.MultipartEncodingFailureReason) {\n        guard bodyPartError == nil else { return }\n        bodyPartError = AFError.multipartEncodingFailed(reason: reason)\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/MultipartUpload.swift",
    "content": "//\n//  MultipartUpload.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Internal type which encapsulates a `MultipartFormData` upload.\nfinal class MultipartUpload {\n    lazy var result = Result { try build() }\n\n    let isInBackgroundSession: Bool\n    let multipartFormData: MultipartFormData\n    let encodingMemoryThreshold: UInt64\n    let request: URLRequestConvertible\n    let fileManager: FileManager\n\n    init(isInBackgroundSession: Bool,\n         encodingMemoryThreshold: UInt64,\n         request: URLRequestConvertible,\n         multipartFormData: MultipartFormData) {\n        self.isInBackgroundSession = isInBackgroundSession\n        self.encodingMemoryThreshold = encodingMemoryThreshold\n        self.request = request\n        fileManager = multipartFormData.fileManager\n        self.multipartFormData = multipartFormData\n    }\n\n    func build() throws -> (request: URLRequest, uploadable: UploadRequest.Uploadable) {\n        var urlRequest = try request.asURLRequest()\n        urlRequest.setValue(multipartFormData.contentType, forHTTPHeaderField: \"Content-Type\")\n\n        let uploadable: UploadRequest.Uploadable\n        if multipartFormData.contentLength < encodingMemoryThreshold && !isInBackgroundSession {\n            let data = try multipartFormData.encode()\n\n            uploadable = .data(data)\n        } else {\n            let tempDirectoryURL = fileManager.temporaryDirectory\n            let directoryURL = tempDirectoryURL.appendingPathComponent(\"org.alamofire.manager/multipart.form.data\")\n            let fileName = UUID().uuidString\n            let fileURL = directoryURL.appendingPathComponent(fileName)\n\n            try fileManager.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil)\n\n            do {\n                try multipartFormData.writeEncodedData(to: fileURL)\n            } catch {\n                // Cleanup after attempted write if it fails.\n                try? fileManager.removeItem(at: fileURL)\n            }\n\n            uploadable = .file(fileURL, shouldRemove: true)\n        }\n\n        return (request: urlRequest, uploadable: uploadable)\n    }\n}\n\nextension MultipartUpload: UploadConvertible {\n    func asURLRequest() throws -> URLRequest {\n        return try result.get().request\n    }\n\n    func createUploadable() throws -> UploadRequest.Uploadable {\n        return try result.get().uploadable\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift",
    "content": "//\n//  NetworkReachabilityManager.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\n#if !(os(watchOS) || os(Linux))\n\nimport Foundation\nimport SystemConfiguration\n\n/// The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both cellular and\n/// WiFi network interfaces.\n///\n/// Reachability can be used to determine background information about why a network operation failed, or to retry\n/// network requests when a connection is established. It should not be used to prevent a user from initiating a network\n/// request, as it's possible that an initial request may be required to establish reachability.\nopen class NetworkReachabilityManager {\n    /// Defines the various states of network reachability.\n    public enum NetworkReachabilityStatus {\n        /// It is unknown whether the network is reachable.\n        case unknown\n        /// The network is not reachable.\n        case notReachable\n        /// The network is reachable on the associated `ConnectionType`.\n        case reachable(ConnectionType)\n\n        init(_ flags: SCNetworkReachabilityFlags) {\n            guard flags.isActuallyReachable else { self = .notReachable; return }\n\n            var networkStatus: NetworkReachabilityStatus = .reachable(.ethernetOrWiFi)\n\n            if flags.isCellular { networkStatus = .reachable(.cellular) }\n\n            self = networkStatus\n        }\n\n        /// Defines the various connection types detected by reachability flags.\n        public enum ConnectionType {\n            /// The connection type is either over Ethernet or WiFi.\n            case ethernetOrWiFi\n            /// The connection type is a cellular connection.\n            case cellular\n        }\n    }\n\n    /// A closure executed when the network reachability status changes. The closure takes a single argument: the\n    /// network reachability status.\n    public typealias Listener = (NetworkReachabilityStatus) -> Void\n\n    /// Default `NetworkReachabilityManager` for the zero address and a `listenerQueue` of `.main`.\n    public static let `default` = NetworkReachabilityManager()\n\n    // MARK: - Properties\n\n    /// Whether the network is currently reachable.\n    open var isReachable: Bool { return isReachableOnCellular || isReachableOnEthernetOrWiFi }\n\n    /// Whether the network is currently reachable over the cellular interface.\n    ///\n    /// - Note: Using this property to decide whether to make a high or low bandwidth request is not recommended.\n    ///         Instead, set the `allowsCellularAccess` on any `URLRequest`s being issued.\n    ///\n    open var isReachableOnCellular: Bool { return status == .reachable(.cellular) }\n\n    /// Whether the network is currently reachable over Ethernet or WiFi interface.\n    open var isReachableOnEthernetOrWiFi: Bool { return status == .reachable(.ethernetOrWiFi) }\n\n    /// `DispatchQueue` on which reachability will update.\n    public let reachabilityQueue = DispatchQueue(label: \"org.alamofire.reachabilityQueue\")\n\n    /// Flags of the current reachability type, if any.\n    open var flags: SCNetworkReachabilityFlags? {\n        var flags = SCNetworkReachabilityFlags()\n\n        return (SCNetworkReachabilityGetFlags(reachability, &flags)) ? flags : nil\n    }\n\n    /// The current network reachability status.\n    open var status: NetworkReachabilityStatus {\n        return flags.map(NetworkReachabilityStatus.init) ?? .unknown\n    }\n\n    /// Mutable state storage.\n    struct MutableState {\n        /// A closure executed when the network reachability status changes.\n        var listener: Listener?\n        /// `DispatchQueue` on which listeners will be called.\n        var listenerQueue: DispatchQueue?\n        /// Previously calculated status.\n        var previousStatus: NetworkReachabilityStatus?\n    }\n\n    /// `SCNetworkReachability` instance providing notifications.\n    private let reachability: SCNetworkReachability\n\n    /// Protected storage for mutable state.\n    private let mutableState = Protector(MutableState())\n\n    // MARK: - Initialization\n\n    /// Creates an instance with the specified host.\n    ///\n    /// - Note: The `host` value must *not* contain a scheme, just the hostname.\n    ///\n    /// - Parameters:\n    ///   - host:          Host used to evaluate network reachability. Must *not* include the scheme (e.g. `https`).\n    public convenience init?(host: String) {\n        guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else { return nil }\n\n        self.init(reachability: reachability)\n    }\n\n    /// Creates an instance that monitors the address 0.0.0.0.\n    ///\n    /// Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing\n    /// status of the device, both IPv4 and IPv6.\n    public convenience init?() {\n        var zero = sockaddr()\n        zero.sa_len = UInt8(MemoryLayout<sockaddr>.size)\n        zero.sa_family = sa_family_t(AF_INET)\n\n        guard let reachability = SCNetworkReachabilityCreateWithAddress(nil, &zero) else { return nil }\n\n        self.init(reachability: reachability)\n    }\n\n    private init(reachability: SCNetworkReachability) {\n        self.reachability = reachability\n    }\n\n    deinit {\n        stopListening()\n    }\n\n    // MARK: - Listening\n\n    /// Starts listening for changes in network reachability status.\n    ///\n    /// - Note: Stops and removes any existing listener.\n    ///\n    /// - Parameters:\n    ///   - queue:    `DispatchQueue` on which to call the `listener` closure. `.main` by default.\n    ///   - listener: `Listener` closure called when reachability changes.\n    ///\n    /// - Returns: `true` if listening was started successfully, `false` otherwise.\n    @discardableResult\n    open func startListening(onQueue queue: DispatchQueue = .main,\n                             onUpdatePerforming listener: @escaping Listener) -> Bool {\n        stopListening()\n\n        mutableState.write { state in\n            state.listenerQueue = queue\n            state.listener = listener\n        }\n\n        var context = SCNetworkReachabilityContext(version: 0,\n                                                   info: Unmanaged.passRetained(self).toOpaque(),\n                                                   retain: nil,\n                                                   release: nil,\n                                                   copyDescription: nil)\n        let callback: SCNetworkReachabilityCallBack = { _, flags, info in\n            guard let info = info else { return }\n\n            let instance = Unmanaged<NetworkReachabilityManager>.fromOpaque(info).takeUnretainedValue()\n            instance.notifyListener(flags)\n        }\n\n        let queueAdded = SCNetworkReachabilitySetDispatchQueue(reachability, reachabilityQueue)\n        let callbackAdded = SCNetworkReachabilitySetCallback(reachability, callback, &context)\n\n        // Manually call listener to give initial state, since the framework may not.\n        if let currentFlags = flags {\n            reachabilityQueue.async {\n                self.notifyListener(currentFlags)\n            }\n        }\n\n        return callbackAdded && queueAdded\n    }\n\n    /// Stops listening for changes in network reachability status.\n    open func stopListening() {\n        SCNetworkReachabilitySetCallback(reachability, nil, nil)\n        SCNetworkReachabilitySetDispatchQueue(reachability, nil)\n        mutableState.write { state in\n            state.listener = nil\n            state.listenerQueue = nil\n            state.previousStatus = nil\n        }\n    }\n\n    // MARK: - Internal - Listener Notification\n\n    /// Calls the `listener` closure of the `listenerQueue` if the computed status hasn't changed.\n    ///\n    /// - Note: Should only be called from the `reachabilityQueue`.\n    ///\n    /// - Parameter flags: `SCNetworkReachabilityFlags` to use to calculate the status.\n    func notifyListener(_ flags: SCNetworkReachabilityFlags) {\n        let newStatus = NetworkReachabilityStatus(flags)\n\n        mutableState.write { state in\n            guard state.previousStatus != newStatus else { return }\n\n            state.previousStatus = newStatus\n\n            let listener = state.listener\n            state.listenerQueue?.async { listener?(newStatus) }\n        }\n    }\n}\n\n// MARK: -\n\nextension NetworkReachabilityManager.NetworkReachabilityStatus: Equatable {}\n\nextension SCNetworkReachabilityFlags {\n    var isReachable: Bool { return contains(.reachable) }\n    var isConnectionRequired: Bool { return contains(.connectionRequired) }\n    var canConnectAutomatically: Bool { return contains(.connectionOnDemand) || contains(.connectionOnTraffic) }\n    var canConnectWithoutUserInteraction: Bool { return canConnectAutomatically && !contains(.interventionRequired) }\n    var isActuallyReachable: Bool { return isReachable && (!isConnectionRequired || canConnectWithoutUserInteraction) }\n    var isCellular: Bool {\n        #if os(iOS) || os(tvOS)\n        return contains(.isWWAN)\n        #else\n        return false\n        #endif\n    }\n\n    /// Human readable `String` for all states, to help with debugging.\n    var readableDescription: String {\n        let W = isCellular ? \"W\" : \"-\"\n        let R = isReachable ? \"R\" : \"-\"\n        let c = isConnectionRequired ? \"c\" : \"-\"\n        let t = contains(.transientConnection) ? \"t\" : \"-\"\n        let i = contains(.interventionRequired) ? \"i\" : \"-\"\n        let C = contains(.connectionOnTraffic) ? \"C\" : \"-\"\n        let D = contains(.connectionOnDemand) ? \"D\" : \"-\"\n        let l = contains(.isLocalAddress) ? \"l\" : \"-\"\n        let d = contains(.isDirect) ? \"d\" : \"-\"\n        let a = contains(.connectionAutomatic) ? \"a\" : \"-\"\n\n        return \"\\(W)\\(R) \\(c)\\(t)\\(i)\\(C)\\(D)\\(l)\\(d)\\(a)\"\n    }\n}\n#endif\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/Notifications.swift",
    "content": "//\n//  Notifications.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\npublic extension Request {\n    /// Posted when a `Request` is resumed. The `Notification` contains the resumed `Request`.\n    static let didResumeNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didResume\")\n    /// Posted when a `Request` is suspended. The `Notification` contains the suspended `Request`.\n    static let didSuspendNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didSuspend\")\n    /// Posted when a `Request` is cancelled. The `Notification` contains the cancelled `Request`.\n    static let didCancelNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didCancel\")\n    /// Posted when a `Request` is finished. The `Notification` contains the completed `Request`.\n    static let didFinishNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didFinish\")\n\n    /// Posted when a `URLSessionTask` is resumed. The `Notification` contains the `Request` associated with the `URLSessionTask`.\n    static let didResumeTaskNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didResumeTask\")\n    /// Posted when a `URLSessionTask` is suspended. The `Notification` contains the `Request` associated with the `URLSessionTask`.\n    static let didSuspendTaskNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didSuspendTask\")\n    /// Posted when a `URLSessionTask` is cancelled. The `Notification` contains the `Request` associated with the `URLSessionTask`.\n    static let didCancelTaskNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didCancelTask\")\n    /// Posted when a `URLSessionTask` is completed. The `Notification` contains the `Request` associated with the `URLSessionTask`.\n    static let didCompleteTaskNotification = Notification.Name(rawValue: \"org.alamofire.notification.name.request.didCompleteTask\")\n}\n\n// MARK: -\n\nextension Notification {\n    /// The `Request` contained by the instance's `userInfo`, `nil` otherwise.\n    public var request: Request? {\n        return userInfo?[String.requestKey] as? Request\n    }\n\n    /// Convenience initializer for a `Notification` containing a `Request` payload.\n    ///\n    /// - Parameters:\n    ///   - name:    The name of the notification.\n    ///   - request: The `Request` payload.\n    init(name: Notification.Name, request: Request) {\n        self.init(name: name, object: nil, userInfo: [String.requestKey: request])\n    }\n}\n\nextension NotificationCenter {\n    /// Convenience function for posting notifications with `Request` payloads.\n    ///\n    /// - Parameters:\n    ///   - name:    The name of the notification.\n    ///   - request: The `Request` payload.\n    func postNotification(named name: Notification.Name, with request: Request) {\n        let notification = Notification(name: name, request: request)\n        post(notification)\n    }\n}\n\nextension String {\n    /// User info dictionary key representing the `Request` associated with the notification.\n    fileprivate static let requestKey = \"org.alamofire.notification.key.request\"\n}\n\n/// `EventMonitor` that provides Alamofire's notifications.\npublic final class AlamofireNotifications: EventMonitor {\n    public func requestDidResume(_ request: Request) {\n        NotificationCenter.default.postNotification(named: Request.didResumeNotification, with: request)\n    }\n\n    public func requestDidSuspend(_ request: Request) {\n        NotificationCenter.default.postNotification(named: Request.didSuspendNotification, with: request)\n    }\n\n    public func requestDidCancel(_ request: Request) {\n        NotificationCenter.default.postNotification(named: Request.didCancelNotification, with: request)\n    }\n\n    public func requestDidFinish(_ request: Request) {\n        NotificationCenter.default.postNotification(named: Request.didFinishNotification, with: request)\n    }\n\n    public func request(_ request: Request, didResumeTask task: URLSessionTask) {\n        NotificationCenter.default.postNotification(named: Request.didResumeTaskNotification, with: request)\n    }\n\n    public func request(_ request: Request, didSuspendTask task: URLSessionTask) {\n        NotificationCenter.default.postNotification(named: Request.didSuspendTaskNotification, with: request)\n    }\n\n    public func request(_ request: Request, didCancelTask task: URLSessionTask) {\n        NotificationCenter.default.postNotification(named: Request.didCancelTaskNotification, with: request)\n    }\n\n    public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?) {\n        NotificationCenter.default.postNotification(named: Request.didCompleteTaskNotification, with: request)\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/OperationQueue+Alamofire.swift",
    "content": "//\n//  OperationQueue+Alamofire.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\nextension OperationQueue {\n    /// Creates an instance using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - qualityOfService:            `QualityOfService` to be applied to the queue. `.default` by default.\n    ///   - maxConcurrentOperationCount: Maximum concurrent operations.\n    ///                                  `OperationQueue.defaultMaxConcurrentOperationCount` by default.\n    ///   - underlyingQueue: Underlying  `DispatchQueue`. `nil` by default.\n    ///   - name:                        Name for the queue. `nil` by default.\n    ///   - startSuspended:              Whether the queue starts suspended. `false` by default.\n    convenience init(qualityOfService: QualityOfService = .default,\n                     maxConcurrentOperationCount: Int = OperationQueue.defaultMaxConcurrentOperationCount,\n                     underlyingQueue: DispatchQueue? = nil,\n                     name: String? = nil,\n                     startSuspended: Bool = false) {\n        self.init()\n        self.qualityOfService = qualityOfService\n        self.maxConcurrentOperationCount = maxConcurrentOperationCount\n        self.underlyingQueue = underlyingQueue\n        self.name = name\n        isSuspended = startSuspended\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/ParameterEncoder.swift",
    "content": "//\n//  ParameterEncoder.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A type that can encode any `Encodable` type into a `URLRequest`.\npublic protocol ParameterEncoder {\n    /// Encode the provided `Encodable` parameters into `request`.\n    ///\n    /// - Parameters:\n    ///   - parameters: The `Encodable` parameter value.\n    ///   - request:    The `URLRequest` into which to encode the parameters.\n    ///\n    /// - Returns:      A `URLRequest` with the result of the encoding.\n    /// - Throws:       An `Error` when encoding fails. For Alamofire provided encoders, this will be an instance of\n    ///                 `AFError.parameterEncoderFailed` with an associated `ParameterEncoderFailureReason`.\n    func encode<Parameters: Encodable>(_ parameters: Parameters?, into request: URLRequest) throws -> URLRequest\n}\n\n/// A `ParameterEncoder` that encodes types as JSON body data.\n///\n/// If no `Content-Type` header is already set on the provided `URLRequest`s, it's set to `application/json`.\nopen class JSONParameterEncoder: ParameterEncoder {\n    /// Returns an encoder with default parameters.\n    public static var `default`: JSONParameterEncoder { return JSONParameterEncoder() }\n\n    /// Returns an encoder with `JSONEncoder.outputFormatting` set to `.prettyPrinted`.\n    public static var prettyPrinted: JSONParameterEncoder {\n        let encoder = JSONEncoder()\n        encoder.outputFormatting = .prettyPrinted\n\n        return JSONParameterEncoder(encoder: encoder)\n    }\n\n    /// Returns an encoder with `JSONEncoder.outputFormatting` set to `.sortedKeys`.\n    @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)\n    public static var sortedKeys: JSONParameterEncoder {\n        let encoder = JSONEncoder()\n        encoder.outputFormatting = .sortedKeys\n\n        return JSONParameterEncoder(encoder: encoder)\n    }\n\n    /// `JSONEncoder` used to encode parameters.\n    public let encoder: JSONEncoder\n\n    /// Creates an instance with the provided `JSONEncoder`.\n    ///\n    /// - Parameter encoder: The `JSONEncoder`. `JSONEncoder()` by default.\n    public init(encoder: JSONEncoder = JSONEncoder()) {\n        self.encoder = encoder\n    }\n\n    open func encode<Parameters: Encodable>(_ parameters: Parameters?,\n                                            into request: URLRequest) throws -> URLRequest {\n        guard let parameters = parameters else { return request }\n\n        var request = request\n\n        do {\n            let data = try encoder.encode(parameters)\n            request.httpBody = data\n            if request.headers[\"Content-Type\"] == nil {\n                request.headers.update(.contentType(\"application/json\"))\n            }\n        } catch {\n            throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error))\n        }\n\n        return request\n    }\n}\n\n/// A `ParameterEncoder` that encodes types as URL-encoded query strings to be set on the URL or as body data, depending\n/// on the `Destination` set.\n///\n/// If no `Content-Type` header is already set on the provided `URLRequest`s, it will be set to\n/// `application/x-www-form-urlencoded; charset=utf-8`.\n///\n/// Encoding behavior can be customized by passing an instance of `URLEncodedFormEncoder` to the initializer.\nopen class URLEncodedFormParameterEncoder: ParameterEncoder {\n    /// Defines where the URL-encoded string should be set for each `URLRequest`.\n    public enum Destination {\n        /// Applies the encoded query string to any existing query string for `.get`, `.head`, and `.delete` request.\n        /// Sets it to the `httpBody` for all other methods.\n        case methodDependent\n        /// Applies the encoded query string to any existing query string from the `URLRequest`.\n        case queryString\n        /// Applies the encoded query string to the `httpBody` of the `URLRequest`.\n        case httpBody\n\n        /// Determines whether the URL-encoded string should be applied to the `URLRequest`'s `url`.\n        ///\n        /// - Parameter method: The `HTTPMethod`.\n        ///\n        /// - Returns:          Whether the URL-encoded string should be applied to a `URL`.\n        func encodesParametersInURL(for method: HTTPMethod) -> Bool {\n            switch self {\n            case .methodDependent: return [.get, .head, .delete].contains(method)\n            case .queryString: return true\n            case .httpBody: return false\n            }\n        }\n    }\n\n    /// Returns an encoder with default parameters.\n    public static var `default`: URLEncodedFormParameterEncoder { return URLEncodedFormParameterEncoder() }\n\n    /// The `URLEncodedFormEncoder` to use.\n    public let encoder: URLEncodedFormEncoder\n\n    /// The `Destination` for the URL-encoded string.\n    public let destination: Destination\n\n    /// Creates an instance with the provided `URLEncodedFormEncoder` instance and `Destination` value.\n    ///\n    /// - Parameters:\n    ///   - encoder:     The `URLEncodedFormEncoder`. `URLEncodedFormEncoder()` by default.\n    ///   - destination: The `Destination`. `.methodDependent` by default.\n    public init(encoder: URLEncodedFormEncoder = URLEncodedFormEncoder(), destination: Destination = .methodDependent) {\n        self.encoder = encoder\n        self.destination = destination\n    }\n\n    open func encode<Parameters: Encodable>(_ parameters: Parameters?,\n                                            into request: URLRequest) throws -> URLRequest {\n        guard let parameters = parameters else { return request }\n\n        var request = request\n\n        guard let url = request.url else {\n            throw AFError.parameterEncoderFailed(reason: .missingRequiredComponent(.url))\n        }\n\n        guard let method = request.method else {\n            let rawValue = request.method?.rawValue ?? \"nil\"\n            throw AFError.parameterEncoderFailed(reason: .missingRequiredComponent(.httpMethod(rawValue: rawValue)))\n        }\n\n        if destination.encodesParametersInURL(for: method),\n            var components = URLComponents(url: url, resolvingAgainstBaseURL: false) {\n            let query: String = try Result<String, Error> { try encoder.encode(parameters) }\n                .mapError { AFError.parameterEncoderFailed(reason: .encoderFailed(error: $0)) }.get()\n            let newQueryString = [components.percentEncodedQuery, query].compactMap { $0 }.joinedWithAmpersands()\n            components.percentEncodedQuery = newQueryString.isEmpty ? nil : newQueryString\n\n            guard let newURL = components.url else {\n                throw AFError.parameterEncoderFailed(reason: .missingRequiredComponent(.url))\n            }\n\n            request.url = newURL\n        } else {\n            if request.headers[\"Content-Type\"] == nil {\n                request.headers.update(.contentType(\"application/x-www-form-urlencoded; charset=utf-8\"))\n            }\n\n            request.httpBody = try Result<Data, Error> { try encoder.encode(parameters) }\n                .mapError { AFError.parameterEncoderFailed(reason: .encoderFailed(error: $0)) }.get()\n        }\n\n        return request\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/ParameterEncoding.swift",
    "content": "//\n//  ParameterEncoding.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A dictionary of parameters to apply to a `URLRequest`.\npublic typealias Parameters = [String: Any]\n\n/// A type used to define how a set of parameters are applied to a `URLRequest`.\npublic protocol ParameterEncoding {\n    /// Creates a `URLRequest` by encoding parameters and applying them on the passed request.\n    ///\n    /// - Parameters:\n    ///   - urlRequest: `URLRequestConvertible` value onto which parameters will be encoded.\n    ///   - parameters: `Parameters` to encode onto the request.\n    ///\n    /// - Returns:      The encoded `URLRequest`.\n    /// - Throws:       Any `Error` produced during parameter encoding.\n    func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest\n}\n\n// MARK: -\n\n/// Creates a url-encoded query string to be set as or appended to any existing URL query string or set as the HTTP\n/// body of the URL request. Whether the query string is set or appended to any existing URL query string or set as\n/// the HTTP body depends on the destination of the encoding.\n///\n/// The `Content-Type` HTTP header field of an encoded request with HTTP body is set to\n/// `application/x-www-form-urlencoded; charset=utf-8`.\n///\n/// There is no published specification for how to encode collection types. By default the convention of appending\n/// `[]` to the key for array values (`foo[]=1&foo[]=2`), and appending the key surrounded by square brackets for\n/// nested dictionary values (`foo[bar]=baz`) is used. Optionally, `ArrayEncoding` can be used to omit the\n/// square brackets appended to array keys.\n///\n/// `BoolEncoding` can be used to configure how boolean values are encoded. The default behavior is to encode\n/// `true` as 1 and `false` as 0.\npublic struct URLEncoding: ParameterEncoding {\n    // MARK: Helper Types\n\n    /// Defines whether the url-encoded query string is applied to the existing query string or HTTP body of the\n    /// resulting URL request.\n    public enum Destination {\n        /// Applies encoded query string result to existing query string for `GET`, `HEAD` and `DELETE` requests and\n        /// sets as the HTTP body for requests with any other HTTP method.\n        case methodDependent\n        /// Sets or appends encoded query string result to existing query string.\n        case queryString\n        /// Sets encoded query string result as the HTTP body of the URL request.\n        case httpBody\n\n        func encodesParametersInURL(for method: HTTPMethod) -> Bool {\n            switch self {\n            case .methodDependent: return [.get, .head, .delete].contains(method)\n            case .queryString: return true\n            case .httpBody: return false\n            }\n        }\n    }\n\n    /// Configures how `Array` parameters are encoded.\n    public enum ArrayEncoding {\n        /// An empty set of square brackets is appended to the key for every value. This is the default behavior.\n        case brackets\n        /// No brackets are appended. The key is encoded as is.\n        case noBrackets\n\n        func encode(key: String) -> String {\n            switch self {\n            case .brackets:\n                return \"\\(key)[]\"\n            case .noBrackets:\n                return key\n            }\n        }\n    }\n\n    /// Configures how `Bool` parameters are encoded.\n    public enum BoolEncoding {\n        /// Encode `true` as `1` and `false` as `0`. This is the default behavior.\n        case numeric\n        /// Encode `true` and `false` as string literals.\n        case literal\n\n        func encode(value: Bool) -> String {\n            switch self {\n            case .numeric:\n                return value ? \"1\" : \"0\"\n            case .literal:\n                return value ? \"true\" : \"false\"\n            }\n        }\n    }\n\n    // MARK: Properties\n\n    /// Returns a default `URLEncoding` instance with a `.methodDependent` destination.\n    public static var `default`: URLEncoding { return URLEncoding() }\n\n    /// Returns a `URLEncoding` instance with a `.queryString` destination.\n    public static var queryString: URLEncoding { return URLEncoding(destination: .queryString) }\n\n    /// Returns a `URLEncoding` instance with an `.httpBody` destination.\n    public static var httpBody: URLEncoding { return URLEncoding(destination: .httpBody) }\n\n    /// The destination defining where the encoded query string is to be applied to the URL request.\n    public let destination: Destination\n\n    /// The encoding to use for `Array` parameters.\n    public let arrayEncoding: ArrayEncoding\n\n    /// The encoding to use for `Bool` parameters.\n    public let boolEncoding: BoolEncoding\n\n    // MARK: Initialization\n\n    /// Creates an instance using the specified parameters.\n    ///\n    /// - Parameters:\n    ///   - destination:   `Destination` defining where the encoded query string will be applied. `.methodDependent` by\n    ///                    default.\n    ///   - arrayEncoding: `ArrayEncoding` to use. `.brackets` by default.\n    ///   - boolEncoding:  `BoolEncoding` to use. `.numeric` by default.\n    public init(destination: Destination = .methodDependent,\n                arrayEncoding: ArrayEncoding = .brackets,\n                boolEncoding: BoolEncoding = .numeric) {\n        self.destination = destination\n        self.arrayEncoding = arrayEncoding\n        self.boolEncoding = boolEncoding\n    }\n\n    // MARK: Encoding\n\n    public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {\n        var urlRequest = try urlRequest.asURLRequest()\n\n        guard let parameters = parameters else { return urlRequest }\n\n        if let method = urlRequest.method, destination.encodesParametersInURL(for: method) {\n            guard let url = urlRequest.url else {\n                throw AFError.parameterEncodingFailed(reason: .missingURL)\n            }\n\n            if var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), !parameters.isEmpty {\n                let percentEncodedQuery = (urlComponents.percentEncodedQuery.map { $0 + \"&\" } ?? \"\") + query(parameters)\n                urlComponents.percentEncodedQuery = percentEncodedQuery\n                urlRequest.url = urlComponents.url\n            }\n        } else {\n            if urlRequest.value(forHTTPHeaderField: \"Content-Type\") == nil {\n                urlRequest.setValue(\"application/x-www-form-urlencoded; charset=utf-8\", forHTTPHeaderField: \"Content-Type\")\n            }\n\n            urlRequest.httpBody = Data(query(parameters).utf8)\n        }\n\n        return urlRequest\n    }\n\n    /// Creates a percent-escaped, URL encoded query string components from the given key-value pair recursively.\n    ///\n    /// - Parameters:\n    ///   - key:   Key of the query component.\n    ///   - value: Value of the query component.\n    ///\n    /// - Returns: The percent-escaped, URL encoded query string components.\n    public func queryComponents(fromKey key: String, value: Any) -> [(String, String)] {\n        var components: [(String, String)] = []\n\n        if let dictionary = value as? [String: Any] {\n            for (nestedKey, value) in dictionary {\n                components += queryComponents(fromKey: \"\\(key)[\\(nestedKey)]\", value: value)\n            }\n        } else if let array = value as? [Any] {\n            for value in array {\n                components += queryComponents(fromKey: arrayEncoding.encode(key: key), value: value)\n            }\n        } else if let value = value as? NSNumber {\n            if value.isBool {\n                components.append((escape(key), escape(boolEncoding.encode(value: value.boolValue))))\n            } else {\n                components.append((escape(key), escape(\"\\(value)\")))\n            }\n        } else if let bool = value as? Bool {\n            components.append((escape(key), escape(boolEncoding.encode(value: bool))))\n        } else {\n            components.append((escape(key), escape(\"\\(value)\")))\n        }\n\n        return components\n    }\n\n    /// Creates a percent-escaped string following RFC 3986 for a query string key or value.\n    ///\n    /// - Parameter string: `String` to be percent-escaped.\n    ///\n    /// - Returns:          The percent-escaped `String`.\n    public func escape(_ string: String) -> String {\n        return string.addingPercentEncoding(withAllowedCharacters: .afURLQueryAllowed) ?? string\n    }\n\n    private func query(_ parameters: [String: Any]) -> String {\n        var components: [(String, String)] = []\n\n        for key in parameters.keys.sorted(by: <) {\n            let value = parameters[key]!\n            components += queryComponents(fromKey: key, value: value)\n        }\n        return components.map { \"\\($0)=\\($1)\" }.joined(separator: \"&\")\n    }\n}\n\n// MARK: -\n\n/// Uses `JSONSerialization` to create a JSON representation of the parameters object, which is set as the body of the\n/// request. The `Content-Type` HTTP header field of an encoded request is set to `application/json`.\npublic struct JSONEncoding: ParameterEncoding {\n    // MARK: Properties\n\n    /// Returns a `JSONEncoding` instance with default writing options.\n    public static var `default`: JSONEncoding { return JSONEncoding() }\n\n    /// Returns a `JSONEncoding` instance with `.prettyPrinted` writing options.\n    public static var prettyPrinted: JSONEncoding { return JSONEncoding(options: .prettyPrinted) }\n\n    /// The options for writing the parameters as JSON data.\n    public let options: JSONSerialization.WritingOptions\n\n    // MARK: Initialization\n\n    /// Creates an instance using the specified `WritingOptions`.\n    ///\n    /// - Parameter options: `JSONSerialization.WritingOptions` to use.\n    public init(options: JSONSerialization.WritingOptions = []) {\n        self.options = options\n    }\n\n    // MARK: Encoding\n\n    public func encode(_ urlRequest: URLRequestConvertible, with parameters: Parameters?) throws -> URLRequest {\n        var urlRequest = try urlRequest.asURLRequest()\n\n        guard let parameters = parameters else { return urlRequest }\n\n        do {\n            let data = try JSONSerialization.data(withJSONObject: parameters, options: options)\n\n            if urlRequest.value(forHTTPHeaderField: \"Content-Type\") == nil {\n                urlRequest.setValue(\"application/json\", forHTTPHeaderField: \"Content-Type\")\n            }\n\n            urlRequest.httpBody = data\n        } catch {\n            throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error))\n        }\n\n        return urlRequest\n    }\n\n    /// Encodes any JSON compatible object into a `URLRequest`.\n    ///\n    /// - Parameters:\n    ///   - urlRequest: `URLRequestConvertible` value into which the object will be encoded.\n    ///   - jsonObject: `Any` value (must be JSON compatible` to be encoded into the `URLRequest`. `nil` by default.\n    ///\n    /// - Returns:      The encoded `URLRequest`.\n    /// - Throws:       Any `Error` produced during encoding.\n    public func encode(_ urlRequest: URLRequestConvertible, withJSONObject jsonObject: Any? = nil) throws -> URLRequest {\n        var urlRequest = try urlRequest.asURLRequest()\n\n        guard let jsonObject = jsonObject else { return urlRequest }\n\n        do {\n            let data = try JSONSerialization.data(withJSONObject: jsonObject, options: options)\n\n            if urlRequest.value(forHTTPHeaderField: \"Content-Type\") == nil {\n                urlRequest.setValue(\"application/json\", forHTTPHeaderField: \"Content-Type\")\n            }\n\n            urlRequest.httpBody = data\n        } catch {\n            throw AFError.parameterEncodingFailed(reason: .jsonEncodingFailed(error: error))\n        }\n\n        return urlRequest\n    }\n}\n\n// MARK: -\n\nextension NSNumber {\n    fileprivate var isBool: Bool { return CFBooleanGetTypeID() == CFGetTypeID(self) }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/Protector.swift",
    "content": "//\n//  Protector.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n// MARK: -\n\n/// An `os_unfair_lock` wrapper.\nfinal class UnfairLock {\n    private let unfairLock: os_unfair_lock_t\n\n    init() {\n        unfairLock = .allocate(capacity: 1)\n        unfairLock.initialize(to: os_unfair_lock())\n    }\n\n    deinit {\n        unfairLock.deinitialize(count: 1)\n        unfairLock.deallocate()\n    }\n\n    private func lock() {\n        os_unfair_lock_lock(unfairLock)\n    }\n\n    private func unlock() {\n        os_unfair_lock_unlock(unfairLock)\n    }\n\n    /// Executes a closure returning a value while acquiring the lock.\n    ///\n    /// - Parameter closure: The closure to run.\n    ///\n    /// - Returns:           The value the closure generated.\n    func around<T>(_ closure: () -> T) -> T {\n        lock(); defer { unlock() }\n        return closure()\n    }\n\n    /// Execute a closure while acquiring the lock.\n    ///\n    /// - Parameter closure: The closure to run.\n    func around(_ closure: () -> Void) {\n        lock(); defer { unlock() }\n        return closure()\n    }\n}\n\n/// A thread-safe wrapper around a value.\nfinal class Protector<T> {\n    private let lock = UnfairLock()\n    private var value: T\n\n    init(_ value: T) {\n        self.value = value\n    }\n\n    /// The contained value. Unsafe for anything more than direct read or write.\n    var directValue: T {\n        get { return lock.around { value } }\n        set { lock.around { value = newValue } }\n    }\n\n    /// Synchronously read or transform the contained value.\n    ///\n    /// - Parameter closure: The closure to execute.\n    ///\n    /// - Returns:           The return value of the closure passed.\n    func read<U>(_ closure: (T) -> U) -> U {\n        return lock.around { closure(self.value) }\n    }\n\n    /// Synchronously modify the protected value.\n    ///\n    /// - Parameter closure: The closure to execute.\n    ///\n    /// - Returns:           The modified value.\n    @discardableResult\n    func write<U>(_ closure: (inout T) -> U) -> U {\n        return lock.around { closure(&self.value) }\n    }\n}\n\nextension Protector where T: RangeReplaceableCollection {\n    /// Adds a new element to the end of this protected collection.\n    ///\n    /// - Parameter newElement: The `Element` to append.\n    func append(_ newElement: T.Element) {\n        write { (ward: inout T) in\n            ward.append(newElement)\n        }\n    }\n\n    /// Adds the elements of a sequence to the end of this protected collection.\n    ///\n    /// - Parameter newElements: The `Sequence` to append.\n    func append<S: Sequence>(contentsOf newElements: S) where S.Element == T.Element {\n        write { (ward: inout T) in\n            ward.append(contentsOf: newElements)\n        }\n    }\n\n    /// Add the elements of a collection to the end of the protected collection.\n    ///\n    /// - Parameter newElements: The `Collection` to append.\n    func append<C: Collection>(contentsOf newElements: C) where C.Element == T.Element {\n        write { (ward: inout T) in\n            ward.append(contentsOf: newElements)\n        }\n    }\n}\n\nextension Protector where T == Data? {\n    /// Adds the contents of a `Data` value to the end of the protected `Data`.\n    ///\n    /// - Parameter data: The `Data` to be appended.\n    func append(_ data: Data) {\n        write { (ward: inout T) in\n            ward?.append(data)\n        }\n    }\n}\n\nextension Protector where T == Request.MutableState {\n    /// Attempts to transition to the passed `State`.\n    ///\n    /// - Parameter state: The `State` to attempt transition to.\n    ///\n    /// - Returns:         Whether the transition occurred.\n    func attemptToTransitionTo(_ state: Request.State) -> Bool {\n        return lock.around {\n            guard value.state.canTransitionTo(state) else { return false }\n\n            value.state = state\n\n            return true\n        }\n    }\n\n    /// Perform a closure while locked with the provided `Request.State`.\n    ///\n    /// - Parameter perform: The closure to perform while locked.\n    func withState(perform: (Request.State) -> Void) {\n        lock.around { perform(value.state) }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/RedirectHandler.swift",
    "content": "//\n//  RedirectHandler.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A type that handles how an HTTP redirect response from a remote server should be redirected to the new request.\npublic protocol RedirectHandler {\n    /// Determines how the HTTP redirect response should be redirected to the new request.\n    ///\n    /// The `completion` closure should be passed one of three possible options:\n    ///\n    ///   1. The new request specified by the redirect (this is the most common use case).\n    ///   2. A modified version of the new request (you may want to route it somewhere else).\n    ///   3. A `nil` value to deny the redirect request and return the body of the redirect response.\n    ///\n    /// - Parameters:\n    ///   - task:       The `URLSessionTask` whose request resulted in a redirect.\n    ///   - request:    The `URLRequest` to the new location specified by the redirect response.\n    ///   - response:   The `HTTPURLResponse` containing the server's response to the original request.\n    ///   - completion: The closure to execute containing the new `URLRequest`, a modified `URLRequest`, or `nil`.\n    func task(_ task: URLSessionTask,\n              willBeRedirectedTo request: URLRequest,\n              for response: HTTPURLResponse,\n              completion: @escaping (URLRequest?) -> Void)\n}\n\n// MARK: -\n\n/// `Redirector` is a convenience `RedirectHandler` making it easy to follow, not follow, or modify a redirect.\npublic struct Redirector {\n    /// Defines the behavior of the `Redirector` type.\n    public enum Behavior {\n        /// Follow the redirect as defined in the response.\n        case follow\n        /// Do not follow the redirect defined in the response.\n        case doNotFollow\n        /// Modify the redirect request defined in the response.\n        case modify((URLSessionTask, URLRequest, HTTPURLResponse) -> URLRequest?)\n    }\n\n    /// Returns a `Redirector` with a `.follow` `Behavior`.\n    public static let follow = Redirector(behavior: .follow)\n    /// Returns a `Redirector` with a `.doNotFollow` `Behavior`.\n    public static let doNotFollow = Redirector(behavior: .doNotFollow)\n\n    /// The `Behavior` of the `Redirector`.\n    public let behavior: Behavior\n\n    /// Creates a `Redirector` instance from the `Behavior`.\n    ///\n    /// - Parameter behavior: The `Behavior`.\n    public init(behavior: Behavior) {\n        self.behavior = behavior\n    }\n}\n\n// MARK: -\n\nextension Redirector: RedirectHandler {\n    public func task(_ task: URLSessionTask,\n                     willBeRedirectedTo request: URLRequest,\n                     for response: HTTPURLResponse,\n                     completion: @escaping (URLRequest?) -> Void) {\n        switch behavior {\n        case .follow:\n            completion(request)\n        case .doNotFollow:\n            completion(nil)\n        case let .modify(closure):\n            let request = closure(task, request, response)\n            completion(request)\n        }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/Request.swift",
    "content": "//\n//  Request.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// `Request` is the common superclass of all Alamofire request types and provides common state, delegate, and callback\n/// handling.\npublic class Request {\n    /// State of the `Request`, with managed transitions between states set when calling `resume()`, `suspend()`, or\n    /// `cancel()` on the `Request`.\n    public enum State {\n        /// Initial state of the `Request`.\n        case initialized\n        /// `State` set when `resume()` is called. Any tasks created for the `Request` will have `resume()` called on\n        /// them in this state.\n        case resumed\n        /// `State` set when `suspend()` is called. Any tasks created for the `Request` will have `suspend()` called on\n        /// them in this state.\n        case suspended\n        /// `State` set when `cancel()` is called. Any tasks created for the `Request` will have `cancel()` called on\n        /// them. Unlike `resumed` or `suspended`, once in the `cancelled` state, the `Request` can no longer transition\n        /// to any other state.\n        case cancelled\n        /// `State` set when all response serialization completion closures have been cleared on the `Request` and\n        /// enqueued on their respective queues.\n        case finished\n\n        /// Determines whether `self` can be transitioned to the provided `State`.\n        func canTransitionTo(_ state: State) -> Bool {\n            switch (self, state) {\n            case (.initialized, _):\n                return true\n            case (_, .initialized), (.cancelled, _), (.finished, _):\n                return false\n            case (.resumed, .cancelled), (.suspended, .cancelled), (.resumed, .suspended), (.suspended, .resumed):\n                return true\n            case (.suspended, .suspended), (.resumed, .resumed):\n                return false\n            case (_, .finished):\n                return true\n            }\n        }\n    }\n\n    // MARK: - Initial State\n\n    /// `UUID` providing a unique identifier for the `Request`, used in the `Hashable` and `Equatable` conformances.\n    public let id: UUID\n    /// The serial queue for all internal async actions.\n    public let underlyingQueue: DispatchQueue\n    /// The queue used for all serialization actions. By default it's a serial queue that targets `underlyingQueue`.\n    public let serializationQueue: DispatchQueue\n    /// `EventMonitor` used for event callbacks.\n    public let eventMonitor: EventMonitor?\n    /// The `Request`'s interceptor.\n    public let interceptor: RequestInterceptor?\n    /// The `Request`'s delegate.\n    public private(set) weak var delegate: RequestDelegate?\n\n    // MARK: - Mutable State\n\n    /// Type encapsulating all mutable state that may need to be accessed from anything other than the `underlyingQueue`.\n    struct MutableState {\n        /// State of the `Request`.\n        var state: State = .initialized\n        /// `ProgressHandler` and `DispatchQueue` provided for upload progress callbacks.\n        var uploadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)?\n        /// `ProgressHandler` and `DispatchQueue` provided for download progress callbacks.\n        var downloadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)?\n        /// `RedirectHandler` provided for to handle request redirection.\n        var redirectHandler: RedirectHandler?\n        /// `CachedResponseHandler` provided to handle response caching.\n        var cachedResponseHandler: CachedResponseHandler?\n        /// Closure called when the `Request` is able to create a cURL description of itself.\n        var cURLHandler: ((String) -> Void)?\n        /// Response serialization closures that handle response parsing.\n        var responseSerializers: [() -> Void] = []\n        /// Response serialization completion closures executed once all response serializers are complete.\n        var responseSerializerCompletions: [() -> Void] = []\n        /// Whether response serializer processing is finished.\n        var responseSerializerProcessingFinished = false\n        /// `URLCredential` used for authentication challenges.\n        var credential: URLCredential?\n        /// All `URLRequest`s created by Alamofire on behalf of the `Request`.\n        var requests: [URLRequest] = []\n        /// All `URLSessionTask`s created by Alamofire on behalf of the `Request`.\n        var tasks: [URLSessionTask] = []\n        /// All `URLSessionTaskMetrics` values gathered by Alamofire on behalf of the `Request`. Should correspond\n        /// exactly the the `tasks` created.\n        var metrics: [URLSessionTaskMetrics] = []\n        /// Number of times any retriers provided retried the `Request`.\n        var retryCount = 0\n        /// Final `AFError` for the `Request`, whether from various internal Alamofire calls or as a result of a `task`.\n        var error: AFError?\n    }\n\n    /// Protected `MutableState` value that provides thread-safe access to state values.\n    fileprivate let protectedMutableState: Protector<MutableState> = Protector(MutableState())\n\n    /// `State` of the `Request`.\n    public var state: State { return protectedMutableState.directValue.state }\n    /// Returns whether `state` is `.initialized`.\n    public var isInitialized: Bool { return state == .initialized }\n    /// Returns whether `state is `.resumed`.\n    public var isResumed: Bool { return state == .resumed }\n    /// Returns whether `state` is `.suspended`.\n    public var isSuspended: Bool { return state == .suspended }\n    /// Returns whether `state` is `.cancelled`.\n    public var isCancelled: Bool { return state == .cancelled }\n    /// Returns whether `state` is `.finished`.\n    public var isFinished: Bool { return state == .finished }\n\n    // MARK: Progress\n\n    /// Closure type executed when monitoring the upload or download progress of a request.\n    public typealias ProgressHandler = (Progress) -> Void\n\n    /// `Progress` of the upload of the body of the executed `URLRequest`. Reset to `0` if the `Request` is retried.\n    public let uploadProgress = Progress(totalUnitCount: 0)\n    /// `Progress` of the download of any response data. Reset to `0` if the `Request` is retried.\n    public let downloadProgress = Progress(totalUnitCount: 0)\n    /// `ProgressHandler` called when `uploadProgress` is updated, on the provided `DispatchQueue`.\n    fileprivate var uploadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)? {\n        get { return protectedMutableState.directValue.uploadProgressHandler }\n        set { protectedMutableState.write { $0.uploadProgressHandler = newValue } }\n    }\n\n    /// `ProgressHandler` called when `downloadProgress` is updated, on the provided `DispatchQueue`.\n    fileprivate var downloadProgressHandler: (handler: ProgressHandler, queue: DispatchQueue)? {\n        get { return protectedMutableState.directValue.downloadProgressHandler }\n        set { protectedMutableState.write { $0.downloadProgressHandler = newValue } }\n    }\n\n    // MARK: Redirect Handling\n\n    /// `RedirectHandler` set on the instance.\n    public private(set) var redirectHandler: RedirectHandler? {\n        get { return protectedMutableState.directValue.redirectHandler }\n        set { protectedMutableState.write { $0.redirectHandler = newValue } }\n    }\n\n    // MARK: Cached Response Handling\n\n    /// `CachedResponseHandler` set on the instance.\n    public private(set) var cachedResponseHandler: CachedResponseHandler? {\n        get { return protectedMutableState.directValue.cachedResponseHandler }\n        set { protectedMutableState.write { $0.cachedResponseHandler = newValue } }\n    }\n\n    // MARK: URLCredential\n\n    /// `URLCredential` used for authentication challenges. Created by calling one of the `authenticate` methods.\n    public private(set) var credential: URLCredential? {\n        get { return protectedMutableState.directValue.credential }\n        set { protectedMutableState.write { $0.credential = newValue } }\n    }\n\n    // MARK: Validators\n\n    /// `Validator` callback closures that store the validation calls enqueued.\n    fileprivate var protectedValidators: Protector<[() -> Void]> = Protector([])\n\n    // MARK: URLRequests\n\n    /// All `URLRequests` created on behalf of the `Request`, including original and adapted requests.\n    public var requests: [URLRequest] { return protectedMutableState.directValue.requests }\n    /// First `URLRequest` created on behalf of the `Request`. May not be the first one actually executed.\n    public var firstRequest: URLRequest? { return requests.first }\n    /// Last `URLRequest` created on behalf of the `Request`.\n    public var lastRequest: URLRequest? { return requests.last }\n    /// Current `URLRequest` created on behalf of the `Request`.\n    public var request: URLRequest? { return lastRequest }\n\n    /// `URLRequest`s from all of the `URLSessionTask`s executed on behalf of the `Request`. May be different from\n    /// `requests` due to `URLSession` manipulation.\n    public var performedRequests: [URLRequest] {\n        return protectedMutableState.read { $0.tasks.compactMap { $0.currentRequest } }\n    }\n\n    // MARK: HTTPURLResponse\n\n    /// `HTTPURLResponse` received from the server, if any. If the `Request` was retried, this is the response of the\n    /// last `URLSessionTask`.\n    public var response: HTTPURLResponse? { return lastTask?.response as? HTTPURLResponse }\n\n    // MARK: Tasks\n\n    /// All `URLSessionTask`s created on behalf of the `Request`.\n    public var tasks: [URLSessionTask] { return protectedMutableState.directValue.tasks }\n    /// First `URLSessionTask` created on behalf of the `Request`.\n    public var firstTask: URLSessionTask? { return tasks.first }\n    /// Last `URLSessionTask` crated on behalf of the `Request`.\n    public var lastTask: URLSessionTask? { return tasks.last }\n    /// Current `URLSessionTask` created on behalf of the `Request`.\n    public var task: URLSessionTask? { return lastTask }\n\n    // MARK: Metrics\n\n    /// All `URLSessionTaskMetrics` gathered on behalf of the `Request`. Should correspond to the `tasks` created.\n    public var allMetrics: [URLSessionTaskMetrics] { return protectedMutableState.directValue.metrics }\n    /// First `URLSessionTaskMetrics` gathered on behalf of the `Request`.\n    public var firstMetrics: URLSessionTaskMetrics? { return allMetrics.first }\n    /// Last `URLSessionTaskMetrics` gathered on behalf of the `Request`.\n    public var lastMetrics: URLSessionTaskMetrics? { return allMetrics.last }\n    /// Current `URLSessionTaskMetrics` gathered on behalf of the `Request`.\n    public var metrics: URLSessionTaskMetrics? { return lastMetrics }\n\n    // MARK: Retry Count\n\n    /// Number of times the `Request` has been retried.\n    public var retryCount: Int { return protectedMutableState.directValue.retryCount }\n\n    // MARK: Error\n\n    /// `Error` returned from Alamofire internally, from the network request directly, or any validators executed.\n    public fileprivate(set) var error: AFError? {\n        get { return protectedMutableState.directValue.error }\n        set { protectedMutableState.write { $0.error = newValue } }\n    }\n\n    /// Default initializer for the `Request` superclass.\n    ///\n    /// - Parameters:\n    ///   - id:                 `UUID` used for the `Hashable` and `Equatable` implementations. `UUID()` by default.\n    ///   - underlyingQueue:    `DispatchQueue` on which all internal `Request` work is performed.\n    ///   - serializationQueue: `DispatchQueue` on which all serialization work is performed. By default targets\n    ///                         `underlyingQueue`, but can be passed another queue from a `Session`.\n    ///   - eventMonitor:       `EventMonitor` called for event callbacks from internal `Request` actions.\n    ///   - interceptor:        `RequestInterceptor` used throughout the request lifecycle.\n    ///   - delegate:           `RequestDelegate` that provides an interface to actions not performed by the `Request`.\n    init(id: UUID = UUID(),\n         underlyingQueue: DispatchQueue,\n         serializationQueue: DispatchQueue,\n         eventMonitor: EventMonitor?,\n         interceptor: RequestInterceptor?,\n         delegate: RequestDelegate) {\n        self.id = id\n        self.underlyingQueue = underlyingQueue\n        self.serializationQueue = serializationQueue\n        self.eventMonitor = eventMonitor\n        self.interceptor = interceptor\n        self.delegate = delegate\n    }\n\n    // MARK: - Internal Event API\n\n    // All API must be called from underlyingQueue.\n\n    /// Called when an initial `URLRequest` has been created on behalf of the instance. If a `RequestAdapter` is active,\n    /// the `URLRequest` will be adapted before being issued.\n    ///\n    /// - Parameter request: The `URLRequest` created.\n    func didCreateInitialURLRequest(_ request: URLRequest) {\n        protectedMutableState.write { $0.requests.append(request) }\n\n        eventMonitor?.request(self, didCreateInitialURLRequest: request)\n    }\n\n    /// Called when initial `URLRequest` creation has failed, typically through a `URLRequestConvertible`.\n    ///\n    /// - Note: Triggers retry.\n    ///\n    /// - Parameter error: `AFError` thrown from the failed creation.\n    func didFailToCreateURLRequest(with error: AFError) {\n        self.error = error\n\n        eventMonitor?.request(self, didFailToCreateURLRequestWithError: error)\n\n        callCURLHandlerIfNecessary()\n\n        retryOrFinish(error: error)\n    }\n\n    /// Called when a `RequestAdapter` has successfully adapted a `URLRequest`.\n    ///\n    /// - Parameters:\n    ///   - initialRequest: The `URLRequest` that was adapted.\n    ///   - adaptedRequest: The `URLRequest` returned by the `RequestAdapter`.\n    func didAdaptInitialRequest(_ initialRequest: URLRequest, to adaptedRequest: URLRequest) {\n        protectedMutableState.write { $0.requests.append(adaptedRequest) }\n\n        eventMonitor?.request(self, didAdaptInitialRequest: initialRequest, to: adaptedRequest)\n    }\n\n    /// Called when a `RequestAdapter` fails to adapt a `URLRequest`.\n    ///\n    /// - Note: Triggers retry.\n    ///\n    /// - Parameters:\n    ///   - request: The `URLRequest` the adapter was called with.\n    ///   - error:   The `AFError` returned by the `RequestAdapter`.\n    func didFailToAdaptURLRequest(_ request: URLRequest, withError error: AFError) {\n        self.error = error\n\n        eventMonitor?.request(self, didFailToAdaptURLRequest: request, withError: error)\n\n        callCURLHandlerIfNecessary()\n\n        retryOrFinish(error: error)\n    }\n\n    /// Final `URLRequest` has been created for the instance.\n    ///\n    /// - Parameter request: The `URLRequest` created.\n    func didCreateURLRequest(_ request: URLRequest) {\n        eventMonitor?.request(self, didCreateURLRequest: request)\n\n        callCURLHandlerIfNecessary()\n    }\n\n    /// Asynchronously calls any stored `cURLHandler` and then removes it from `mutableState`.\n    private func callCURLHandlerIfNecessary() {\n        protectedMutableState.write { mutableState in\n            guard let cURLHandler = mutableState.cURLHandler else { return }\n\n            self.underlyingQueue.async { cURLHandler(self.cURLDescription()) }\n            mutableState.cURLHandler = nil\n        }\n    }\n\n    /// Called when a `URLSessionTask` is created on behalf of the instance.\n    ///\n    /// - Parameter task: The `URLSessionTask` created.\n    func didCreateTask(_ task: URLSessionTask) {\n        protectedMutableState.write { $0.tasks.append(task) }\n\n        eventMonitor?.request(self, didCreateTask: task)\n    }\n\n    /// Called when resumption is completed.\n    func didResume() {\n        eventMonitor?.requestDidResume(self)\n    }\n\n    /// Called when a `URLSessionTask` is resumed on behalf of the instance.\n    ///\n    /// - Parameter task: The `URLSessionTask` resumed.\n    func didResumeTask(_ task: URLSessionTask) {\n        eventMonitor?.request(self, didResumeTask: task)\n    }\n\n    /// Called when suspension is completed.\n    func didSuspend() {\n        eventMonitor?.requestDidSuspend(self)\n    }\n\n    /// Called when a `URLSessionTask` is suspended on behalf of the instance.\n    ///\n    /// - Parameter task: The `URLSessionTask` suspended.\n    func didSuspendTask(_ task: URLSessionTask) {\n        eventMonitor?.request(self, didSuspendTask: task)\n    }\n\n    /// Called when cancellation is completed, sets `error` to `AFError.explicitlyCancelled`.\n    func didCancel() {\n        error = AFError.explicitlyCancelled\n\n        eventMonitor?.requestDidCancel(self)\n    }\n\n    /// Called when a `URLSessionTask` is cancelled on behalf of the instance.\n    ///\n    /// - Parameter task: The `URLSessionTask` cancelled.\n    func didCancelTask(_ task: URLSessionTask) {\n        eventMonitor?.request(self, didCancelTask: task)\n    }\n\n    /// Called when a `URLSessionTaskMetrics` value is gathered on behalf of the instance.\n    ///\n    /// - Parameter metrics: The `URLSessionTaskMetrics` gathered.\n    func didGatherMetrics(_ metrics: URLSessionTaskMetrics) {\n        protectedMutableState.write { $0.metrics.append(metrics) }\n\n        eventMonitor?.request(self, didGatherMetrics: metrics)\n    }\n\n    /// Called when a `URLSessionTask` fails before it is finished, typically during certificate pinning.\n    ///\n    /// - Parameters:\n    ///   - task:  The `URLSessionTask` which failed.\n    ///   - error: The early failure `AFError`.\n    func didFailTask(_ task: URLSessionTask, earlyWithError error: AFError) {\n        self.error = error\n\n        // Task will still complete, so didCompleteTask(_:with:) will handle retry.\n        eventMonitor?.request(self, didFailTask: task, earlyWithError: error)\n    }\n\n    /// Called when a `URLSessionTask` completes. All tasks will eventually call this method.\n    ///\n    /// - Note: Response validation is synchronously triggered in this step.\n    ///\n    /// - Parameters:\n    ///   - task:  The `URLSessionTask` which completed.\n    ///   - error: The `AFError` `task` may have completed with. If `error` has already been set on the instance, this\n    ///            value is ignored.\n    func didCompleteTask(_ task: URLSessionTask, with error: AFError?) {\n        self.error = self.error ?? error\n        protectedValidators.directValue.forEach { $0() }\n\n        eventMonitor?.request(self, didCompleteTask: task, with: error)\n\n        retryOrFinish(error: self.error)\n    }\n\n    /// Called when the `RequestDelegate` is going to retry this `Request`. Calls `reset()`.\n    func prepareForRetry() {\n        protectedMutableState.write { $0.retryCount += 1 }\n\n        reset()\n\n        eventMonitor?.requestIsRetrying(self)\n    }\n\n    /// Called to determine whether retry will be triggered for the particular error, or whether the instance should\n    /// call `finish()`.\n    ///\n    /// - Parameter error: The possible `AFError` which may trigger retry.\n    func retryOrFinish(error: AFError?) {\n        guard let error = error, let delegate = delegate else { finish(); return }\n\n        delegate.retryResult(for: self, dueTo: error) { retryResult in\n            switch retryResult {\n            case .doNotRetry:\n                self.finish()\n            case let .doNotRetryWithError(retryError):\n                self.finish(error: retryError.asAFError(orFailWith: \"Received retryError was not already AFError\"))\n            case .retry, .retryWithDelay:\n                delegate.retryRequest(self, withDelay: retryResult.delay)\n            }\n        }\n    }\n\n    /// Finishes this `Request` and starts the response serializers.\n    ///\n    /// - Parameter error: The possible `Error` with which the instance will finish.\n    func finish(error: AFError? = nil) {\n        if let error = error { self.error = error }\n\n        // Start response handlers\n        processNextResponseSerializer()\n\n        eventMonitor?.requestDidFinish(self)\n    }\n\n    /// Appends the response serialization closure to the instance.\n    ///\n    ///  - Note: This method will also `resume` the instance if `delegate.startImmediately` returns `true`.\n    ///\n    /// - Parameter closure: The closure containing the response serialization call.\n    func appendResponseSerializer(_ closure: @escaping () -> Void) {\n        protectedMutableState.write { mutableState in\n            mutableState.responseSerializers.append(closure)\n\n            if mutableState.state == .finished {\n                mutableState.state = .resumed\n            }\n\n            if mutableState.responseSerializerProcessingFinished {\n                underlyingQueue.async { self.processNextResponseSerializer() }\n            }\n\n            if mutableState.state.canTransitionTo(.resumed) {\n                underlyingQueue.async { if self.delegate?.startImmediately == true { self.resume() } }\n            }\n        }\n    }\n\n    /// Returns the next response serializer closure to execute if there's one left.\n    ///\n    /// - Returns: The next response serialization closure, if there is one.\n    func nextResponseSerializer() -> (() -> Void)? {\n        var responseSerializer: (() -> Void)?\n\n        protectedMutableState.write { mutableState in\n            let responseSerializerIndex = mutableState.responseSerializerCompletions.count\n\n            if responseSerializerIndex < mutableState.responseSerializers.count {\n                responseSerializer = mutableState.responseSerializers[responseSerializerIndex]\n            }\n        }\n\n        return responseSerializer\n    }\n\n    /// Processes the next response serializer and calls all completions if response serialization is complete.\n    func processNextResponseSerializer() {\n        guard let responseSerializer = nextResponseSerializer() else {\n            // Execute all response serializer completions and clear them\n            var completions: [() -> Void] = []\n\n            protectedMutableState.write { mutableState in\n                completions = mutableState.responseSerializerCompletions\n\n                // Clear out all response serializers and response serializer completions in mutable state since the\n                // request is complete. It's important to do this prior to calling the completion closures in case\n                // the completions call back into the request triggering a re-processing of the response serializers.\n                // An example of how this can happen is by calling cancel inside a response completion closure.\n                mutableState.responseSerializers.removeAll()\n                mutableState.responseSerializerCompletions.removeAll()\n\n                if mutableState.state.canTransitionTo(.finished) {\n                    mutableState.state = .finished\n                }\n\n                mutableState.responseSerializerProcessingFinished = true\n            }\n\n            completions.forEach { $0() }\n\n            // Cleanup the request\n            cleanup()\n\n            return\n        }\n\n        serializationQueue.async { responseSerializer() }\n    }\n\n    /// Notifies the `Request` that the response serializer is complete.\n    ///\n    /// - Parameter completion: The completion handler provided with the response serializer, called when all serializers\n    ///                         are complete.\n    func responseSerializerDidComplete(completion: @escaping () -> Void) {\n        protectedMutableState.write { $0.responseSerializerCompletions.append(completion) }\n        processNextResponseSerializer()\n    }\n\n    /// Resets all task and response serializer related state for retry.\n    func reset() {\n        error = nil\n\n        uploadProgress.totalUnitCount = 0\n        uploadProgress.completedUnitCount = 0\n        downloadProgress.totalUnitCount = 0\n        downloadProgress.completedUnitCount = 0\n\n        protectedMutableState.write { $0.responseSerializerCompletions = [] }\n    }\n\n    /// Called when updating the upload progress.\n    ///\n    /// - Parameters:\n    ///   - totalBytesSent: Total bytes sent so far.\n    ///   - totalBytesExpectedToSend: Total bytes expected to send.\n    func updateUploadProgress(totalBytesSent: Int64, totalBytesExpectedToSend: Int64) {\n        uploadProgress.totalUnitCount = totalBytesExpectedToSend\n        uploadProgress.completedUnitCount = totalBytesSent\n\n        uploadProgressHandler?.queue.async { self.uploadProgressHandler?.handler(self.uploadProgress) }\n    }\n\n    /// Perform a closure on the current `state` while locked.\n    ///\n    /// - Parameter perform: The closure to perform.\n    func withState(perform: (State) -> Void) {\n        protectedMutableState.withState(perform: perform)\n    }\n\n    // MARK: Task Creation\n\n    /// Called when creating a `URLSessionTask` for this `Request`. Subclasses must override.\n    ///\n    /// - Parameters:\n    ///   - request: `URLRequest` to use to create the `URLSessionTask`.\n    ///   - session: `URLSession` which creates the `URLSessionTask`.\n    ///\n    /// - Returns:   The `URLSessionTask` created.\n    func task(for request: URLRequest, using session: URLSession) -> URLSessionTask {\n        fatalError(\"Subclasses must override.\")\n    }\n\n    // MARK: - Public API\n\n    // These APIs are callable from any queue.\n\n    // MARK: State\n\n    /// Cancels the instance. Once cancelled, a `Request` can no longer be resumed or suspended.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    public func cancel() -> Self {\n        protectedMutableState.write { mutableState in\n            guard mutableState.state.canTransitionTo(.cancelled) else { return }\n\n            mutableState.state = .cancelled\n\n            underlyingQueue.async { self.didCancel() }\n\n            guard let task = mutableState.tasks.last, task.state != .completed else {\n                underlyingQueue.async { self.finish() }\n                return\n            }\n\n            // Resume to ensure metrics are gathered.\n            task.resume()\n            task.cancel()\n            underlyingQueue.async { self.didCancelTask(task) }\n        }\n\n        return self\n    }\n\n    /// Suspends the instance.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    public func suspend() -> Self {\n        protectedMutableState.write { mutableState in\n            guard mutableState.state.canTransitionTo(.suspended) else { return }\n\n            mutableState.state = .suspended\n\n            underlyingQueue.async { self.didSuspend() }\n\n            guard let task = mutableState.tasks.last, task.state != .completed else { return }\n\n            task.suspend()\n            underlyingQueue.async { self.didSuspendTask(task) }\n        }\n\n        return self\n    }\n\n    /// Resumes the instance.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    public func resume() -> Self {\n        protectedMutableState.write { mutableState in\n            guard mutableState.state.canTransitionTo(.resumed) else { return }\n\n            mutableState.state = .resumed\n\n            underlyingQueue.async { self.didResume() }\n\n            guard let task = mutableState.tasks.last, task.state != .completed else { return }\n\n            task.resume()\n            underlyingQueue.async { self.didResumeTask(task) }\n        }\n\n        return self\n    }\n\n    // MARK: - Closure API\n\n    /// Associates a credential using the provided values with the instance.\n    ///\n    /// - Parameters:\n    ///   - username:    The username.\n    ///   - password:    The password.\n    ///   - persistence: The `URLCredential.Persistence` for the created `URLCredential`. `.forSession` by default.\n    ///\n    /// - Returns:       The instance.\n    @discardableResult\n    public func authenticate(username: String, password: String, persistence: URLCredential.Persistence = .forSession) -> Self {\n        let credential = URLCredential(user: username, password: password, persistence: persistence)\n\n        return authenticate(with: credential)\n    }\n\n    /// Associates the provided credential with the instance.\n    ///\n    /// - Parameter credential: The `URLCredential`.\n    ///\n    /// - Returns:              The instance.\n    @discardableResult\n    public func authenticate(with credential: URLCredential) -> Self {\n        protectedMutableState.write { $0.credential = credential }\n\n        return self\n    }\n\n    /// Sets a closure to be called periodically during the lifecycle of the instance as data is read from the server.\n    ///\n    /// - Note: Only the last closure provided is used.\n    ///\n    /// - Parameters:\n    ///   - queue:   The `DispatchQueue` to execute the closure on. `.main` by default.\n    ///   - closure: The closure to be executed periodically as data is read from the server.\n    ///\n    /// - Returns:   The instance.\n    @discardableResult\n    public func downloadProgress(queue: DispatchQueue = .main, closure: @escaping ProgressHandler) -> Self {\n        protectedMutableState.write { $0.downloadProgressHandler = (handler: closure, queue: queue) }\n\n        return self\n    }\n\n    /// Sets a closure to be called periodically during the lifecycle of the instance as data is sent to the server.\n    ///\n    /// - Note: Only the last closure provided is used.\n    ///\n    /// - Parameters:\n    ///   - queue:   The `DispatchQueue` to execute the closure on. `.main` by default.\n    ///   - closure: The closure to be executed periodically as data is sent to the server.\n    ///\n    /// - Returns:   The instance.\n    @discardableResult\n    public func uploadProgress(queue: DispatchQueue = .main, closure: @escaping ProgressHandler) -> Self {\n        protectedMutableState.write { $0.uploadProgressHandler = (handler: closure, queue: queue) }\n\n        return self\n    }\n\n    // MARK: Redirects\n\n    /// Sets the redirect handler for the instance which will be used if a redirect response is encountered.\n    ///\n    /// - Note: Attempting to set the redirect handler more than once is a logic error and will crash.\n    ///\n    /// - Parameter handler: The `RedirectHandler`.\n    ///\n    /// - Returns:           The instance.\n    @discardableResult\n    public func redirect(using handler: RedirectHandler) -> Self {\n        protectedMutableState.write { mutableState in\n            precondition(mutableState.redirectHandler == nil, \"Redirect handler has already been set.\")\n            mutableState.redirectHandler = handler\n        }\n\n        return self\n    }\n\n    // MARK: Cached Responses\n\n    /// Sets the cached response handler for the `Request` which will be used when attempting to cache a response.\n    ///\n    /// - Note: Attempting to set the cache handler more than once is a logic error and will crash.\n    ///\n    /// - Parameter handler: The `CachedResponseHandler`.\n    ///\n    /// - Returns:           The instance.\n    @discardableResult\n    public func cacheResponse(using handler: CachedResponseHandler) -> Self {\n        protectedMutableState.write { mutableState in\n            precondition(mutableState.cachedResponseHandler == nil, \"Cached response handler has already been set.\")\n            mutableState.cachedResponseHandler = handler\n        }\n\n        return self\n    }\n\n    /// Sets a handler to be called when the cURL description of the request is available.\n    ///\n    /// - Note: When waiting for a `Request`'s `URLRequest` to be created, only the last `handler` will be called.\n    ///\n    /// - Parameter handler: Closure to be called when the cURL description is available.\n    ///\n    /// - Returns:           The instance.\n    @discardableResult\n    public func cURLDescription(calling handler: @escaping (String) -> Void) -> Self {\n        protectedMutableState.write { mutableState in\n            if mutableState.requests.last != nil {\n                underlyingQueue.async { handler(self.cURLDescription()) }\n            } else {\n                mutableState.cURLHandler = handler\n            }\n        }\n\n        return self\n    }\n\n    // MARK: Cleanup\n\n    /// Final cleanup step executed when the instance finishes response serialization.\n    func cleanup() {\n        delegate?.cleanup(after: self)\n        // No-op: override in subclass\n    }\n}\n\n// MARK: - Protocol Conformances\n\nextension Request: Equatable {\n    public static func ==(lhs: Request, rhs: Request) -> Bool {\n        return lhs.id == rhs.id\n    }\n}\n\nextension Request: Hashable {\n    public func hash(into hasher: inout Hasher) {\n        hasher.combine(id)\n    }\n}\n\nextension Request: CustomStringConvertible {\n    /// A textual representation of this instance, including the `HTTPMethod` and `URL` if the `URLRequest` has been\n    /// created, as well as the response status code, if a response has been received.\n    public var description: String {\n        guard let request = performedRequests.last ?? lastRequest,\n            let url = request.url,\n            let method = request.httpMethod else { return \"No request created yet.\" }\n\n        let requestDescription = \"\\(method) \\(url.absoluteString)\"\n\n        return response.map { \"\\(requestDescription) (\\($0.statusCode))\" } ?? requestDescription\n    }\n}\n\nextension Request {\n    /// cURL representation of the instance.\n    ///\n    /// - Returns: The cURL equivalent of the instance.\n    public func cURLDescription() -> String {\n        guard\n            let request = lastRequest,\n            let url = request.url,\n            let host = url.host,\n            let method = request.httpMethod else { return \"$ curl command could not be created\" }\n\n        var components = [\"$ curl -v\"]\n\n        components.append(\"-X \\(method)\")\n\n        if let credentialStorage = delegate?.sessionConfiguration.urlCredentialStorage {\n            let protectionSpace = URLProtectionSpace(host: host,\n                                                     port: url.port ?? 0,\n                                                     protocol: url.scheme,\n                                                     realm: host,\n                                                     authenticationMethod: NSURLAuthenticationMethodHTTPBasic)\n\n            if let credentials = credentialStorage.credentials(for: protectionSpace)?.values {\n                for credential in credentials {\n                    guard let user = credential.user, let password = credential.password else { continue }\n                    components.append(\"-u \\(user):\\(password)\")\n                }\n            } else {\n                if let credential = credential, let user = credential.user, let password = credential.password {\n                    components.append(\"-u \\(user):\\(password)\")\n                }\n            }\n        }\n\n        if let configuration = delegate?.sessionConfiguration, configuration.httpShouldSetCookies {\n            if\n                let cookieStorage = configuration.httpCookieStorage,\n                let cookies = cookieStorage.cookies(for: url), !cookies.isEmpty {\n                let allCookies = cookies.map { \"\\($0.name)=\\($0.value)\" }.joined(separator: \";\")\n\n                components.append(\"-b \\\"\\(allCookies)\\\"\")\n            }\n        }\n\n        var headers = HTTPHeaders()\n\n        if let sessionHeaders = delegate?.sessionConfiguration.headers {\n            for header in sessionHeaders where header.name != \"Cookie\" {\n                headers[header.name] = header.value\n            }\n        }\n\n        for header in request.headers where header.name != \"Cookie\" {\n            headers[header.name] = header.value\n        }\n\n        for header in headers {\n            let escapedValue = header.value.replacingOccurrences(of: \"\\\"\", with: \"\\\\\\\"\")\n            components.append(\"-H \\\"\\(header.name): \\(escapedValue)\\\"\")\n        }\n\n        if let httpBodyData = request.httpBody {\n            let httpBody = String(decoding: httpBodyData, as: UTF8.self)\n            var escapedBody = httpBody.replacingOccurrences(of: \"\\\\\\\"\", with: \"\\\\\\\\\\\"\")\n            escapedBody = escapedBody.replacingOccurrences(of: \"\\\"\", with: \"\\\\\\\"\")\n\n            components.append(\"-d \\\"\\(escapedBody)\\\"\")\n        }\n\n        components.append(\"\\\"\\(url.absoluteString)\\\"\")\n\n        return components.joined(separator: \" \\\\\\n\\t\")\n    }\n}\n\n/// Protocol abstraction for `Request`'s communication back to the `SessionDelegate`.\npublic protocol RequestDelegate: AnyObject {\n    /// `URLSessionConfiguration` used to create the underlying `URLSessionTask`s.\n    var sessionConfiguration: URLSessionConfiguration { get }\n\n    /// Determines whether the `Request` should automatically call `resume()` when adding the first response handler.\n    var startImmediately: Bool { get }\n\n    /// Notifies the delegate the `Request` has reached a point where it needs cleanup.\n    ///\n    /// - Parameter request: The `Request` to cleanup after.\n    func cleanup(after request: Request)\n\n    /// Asynchronously ask the delegate whether a `Request` will be retried.\n    ///\n    /// - Parameters:\n    ///   - request:    `Request` which failed.\n    ///   - error:      `Error` which produced the failure.\n    ///   - completion: Closure taking the `RetryResult` for evaluation.\n    func retryResult(for request: Request, dueTo error: AFError, completion: @escaping (RetryResult) -> Void)\n\n    /// Asynchronously retry the `Request`.\n    ///\n    /// - Parameters:\n    ///   - request:   `Request` which will be retried.\n    ///   - timeDelay: `TimeInterval` after which the retry will be triggered.\n    func retryRequest(_ request: Request, withDelay timeDelay: TimeInterval?)\n}\n\n// MARK: - Subclasses\n\n// MARK: - DataRequest\n\n/// `Request` subclass which handles in-memory `Data` download using `URLSessionDataTask`.\npublic class DataRequest: Request {\n    /// `URLRequestConvertible` value used to create `URLRequest`s for this instance.\n    public let convertible: URLRequestConvertible\n    /// `Data` read from the server so far.\n    public var data: Data? { return protectedData.directValue }\n\n    /// Protected storage for the `Data` read by the instance.\n    private var protectedData: Protector<Data?> = Protector(nil)\n\n    /// Creates a `DataRequest` using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - id:                 `UUID` used for the `Hashable` and `Equatable` implementations. `UUID()` by default.\n    ///   - convertible:        `URLRequestConvertible` value used to create `URLRequest`s for this instance.\n    ///   - underlyingQueue:    `DispatchQueue` on which all internal `Request` work is performed.\n    ///   - serializationQueue: `DispatchQueue` on which all serialization work is performed. By default targets\n    ///                         `underlyingQueue`, but can be passed another queue from a `Session`.\n    ///   - eventMonitor:       `EventMonitor` called for event callbacks from internal `Request` actions.\n    ///   - interceptor:        `RequestInterceptor` used throughout the request lifecycle.\n    ///   - delegate:           `RequestDelegate` that provides an interface to actions not performed by the `Request`.\n    init(id: UUID = UUID(),\n         convertible: URLRequestConvertible,\n         underlyingQueue: DispatchQueue,\n         serializationQueue: DispatchQueue,\n         eventMonitor: EventMonitor?,\n         interceptor: RequestInterceptor?,\n         delegate: RequestDelegate) {\n        self.convertible = convertible\n\n        super.init(id: id,\n                   underlyingQueue: underlyingQueue,\n                   serializationQueue: serializationQueue,\n                   eventMonitor: eventMonitor,\n                   interceptor: interceptor,\n                   delegate: delegate)\n    }\n\n    override func reset() {\n        super.reset()\n\n        protectedData.directValue = nil\n    }\n\n    /// Called when `Data` is received by this instance.\n    ///\n    /// - Note: Also calls `updateDownloadProgress`.\n    ///\n    /// - Parameter data: The `Data` received.\n    func didReceive(data: Data) {\n        if self.data == nil {\n            protectedData.directValue = data\n        } else {\n            protectedData.append(data)\n        }\n\n        updateDownloadProgress()\n    }\n\n    override func task(for request: URLRequest, using session: URLSession) -> URLSessionTask {\n        let copiedRequest = request\n        return session.dataTask(with: copiedRequest)\n    }\n\n    /// Called to updated the `downloadProgress` of the instance.\n    func updateDownloadProgress() {\n        let totalBytesReceived = Int64(data?.count ?? 0)\n        let totalBytesExpected = task?.response?.expectedContentLength ?? NSURLSessionTransferSizeUnknown\n\n        downloadProgress.totalUnitCount = totalBytesExpected\n        downloadProgress.completedUnitCount = totalBytesReceived\n\n        downloadProgressHandler?.queue.async { self.downloadProgressHandler?.handler(self.downloadProgress) }\n    }\n\n    /// Validates the request, using the specified closure.\n    ///\n    /// - Note: If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - Parameter validation: `Validation` closure used to validate the response.\n    ///\n    /// - Returns:              The instance.\n    @discardableResult\n    public func validate(_ validation: @escaping Validation) -> Self {\n        let validator: () -> Void = { [unowned self] in\n            guard self.error == nil, let response = self.response else { return }\n\n            let result = validation(self.request, response, self.data)\n\n            if case let .failure(error) = result { self.error = error.asAFError(or: .responseValidationFailed(reason: .customValidationFailed(error: error))) }\n\n            self.eventMonitor?.request(self,\n                                       didValidateRequest: self.request,\n                                       response: response,\n                                       data: self.data,\n                                       withResult: result)\n        }\n\n        protectedValidators.append(validator)\n\n        return self\n    }\n}\n\n// MARK: - DownloadRequest\n\n/// `Request` subclass which downloads `Data` to a file on disk using `URLSessionDownloadTask`.\npublic class DownloadRequest: Request {\n    /// A set of options to be executed prior to moving a downloaded file from the temporary `URL` to the destination\n    /// `URL`.\n    public struct Options: OptionSet {\n        /// Specifies that intermediate directories for the destination URL should be created.\n        public static let createIntermediateDirectories = Options(rawValue: 1 << 0)\n        /// Specifies that any previous file at the destination `URL` should be removed.\n        public static let removePreviousFile = Options(rawValue: 1 << 1)\n\n        public let rawValue: Int\n\n        public init(rawValue: Int) {\n            self.rawValue = rawValue\n        }\n    }\n\n    // MARK: Destination\n\n    /// A closure executed once a `DownloadRequest` has successfully completed in order to determine where to move the\n    /// temporary file written to during the download process. The closure takes two arguments: the temporary file URL\n    /// and the URL response, and returns a two arguments: the file URL where the temporary file should be moved and\n    /// the options defining how the file should be moved.\n    public typealias Destination = (_ temporaryURL: URL,\n                                    _ response: HTTPURLResponse) -> (destinationURL: URL, options: Options)\n\n    /// Creates a download file destination closure which uses the default file manager to move the temporary file to a\n    /// file URL in the first available directory with the specified search path directory and search path domain mask.\n    ///\n    /// - Parameters:\n    ///   - directory: The search path directory. `.documentDirectory` by default.\n    ///   - domain:    The search path domain mask. `.userDomainMask` by default.\n    ///   - options:   `DownloadRequest.Options` used when moving the downloaded file to its destination. None by\n    ///                default.\n    /// - Returns: The `Destination` closure.\n    public class func suggestedDownloadDestination(for directory: FileManager.SearchPathDirectory = .documentDirectory,\n                                                   in domain: FileManager.SearchPathDomainMask = .userDomainMask,\n                                                   options: Options = []) -> Destination {\n        return { temporaryURL, response in\n            let directoryURLs = FileManager.default.urls(for: directory, in: domain)\n            let url = directoryURLs.first?.appendingPathComponent(response.suggestedFilename!) ?? temporaryURL\n\n            return (url, options)\n        }\n    }\n\n    /// Default `Destination` used by Alamofire to ensure all downloads persist. This `Destination` prepends\n    /// `Alamofire_` to the automatically generated download name and moves it within the temporary directory. Files\n    /// with this destination must be additionally moved if they should survive the system reclamation of temporary\n    /// space.\n    static let defaultDestination: Destination = { url, _ in\n        let filename = \"Alamofire_\\(url.lastPathComponent)\"\n        let destination = url.deletingLastPathComponent().appendingPathComponent(filename)\n\n        return (destination, [])\n    }\n\n    // MARK: Downloadable\n\n    /// Type describing the source used to create the underlying `URLSessionDownloadTask`.\n    public enum Downloadable {\n        /// Download should be started from the `URLRequest` produced by the associated `URLRequestConvertible` value.\n        case request(URLRequestConvertible)\n        /// Download should be started from the associated resume `Data` value.\n        case resumeData(Data)\n    }\n\n    // MARK: Mutable State\n\n    /// Type containing all mutable state for `DownloadRequest` instances.\n    private struct DownloadRequestMutableState {\n        /// Possible resume `Data` produced when cancelling the instance.\n        var resumeData: Data?\n        /// `URL` to which `Data` is being downloaded.\n        var fileURL: URL?\n    }\n\n    /// Protected mutable state specific to `DownloadRequest`.\n    private let protectedDownloadMutableState: Protector<DownloadRequestMutableState> = Protector(DownloadRequestMutableState())\n\n    /// If the download is resumable and eventually cancelled, this value may be used to resume the download using the\n    /// `download(resumingWith data:)` API.\n    ///\n    /// - Note: For more information about `resumeData`, see [Apple's documentation](https://developer.apple.com/documentation/foundation/urlsessiondownloadtask/1411634-cancel).\n    public var resumeData: Data? { return protectedDownloadMutableState.directValue.resumeData }\n    /// If the download is successful, the `URL` where the file was downloaded.\n    public var fileURL: URL? { return protectedDownloadMutableState.directValue.fileURL }\n\n    // MARK: Initial State\n\n    /// `Downloadable` value used for this instance.\n    public let downloadable: Downloadable\n    /// The `Destination` to which the downloaded file is moved.\n    let destination: Destination\n\n    /// Creates a `DownloadRequest` using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - id:                 `UUID` used for the `Hashable` and `Equatable` implementations. `UUID()` by default.\n    ///   - downloadable:       `Downloadable` value used to create `URLSessionDownloadTasks` for the instance.\n    ///   - underlyingQueue:    `DispatchQueue` on which all internal `Request` work is performed.\n    ///   - serializationQueue: `DispatchQueue` on which all serialization work is performed. By default targets\n    ///                         `underlyingQueue`, but can be passed another queue from a `Session`.\n    ///   - eventMonitor:       `EventMonitor` called for event callbacks from internal `Request` actions.\n    ///   - interceptor:        `RequestInterceptor` used throughout the request lifecycle.\n    ///   - delegate:           `RequestDelegate` that provides an interface to actions not performed by the `Request`\n    ///   - destination:        `Destination` closure used to move the downloaded file to its final location.\n    init(id: UUID = UUID(),\n         downloadable: Downloadable,\n         underlyingQueue: DispatchQueue,\n         serializationQueue: DispatchQueue,\n         eventMonitor: EventMonitor?,\n         interceptor: RequestInterceptor?,\n         delegate: RequestDelegate,\n         destination: @escaping Destination) {\n        self.downloadable = downloadable\n        self.destination = destination\n\n        super.init(id: id,\n                   underlyingQueue: underlyingQueue,\n                   serializationQueue: serializationQueue,\n                   eventMonitor: eventMonitor,\n                   interceptor: interceptor,\n                   delegate: delegate)\n    }\n\n    override func reset() {\n        super.reset()\n\n        protectedDownloadMutableState.write {\n            $0.resumeData = nil\n            $0.fileURL = nil\n        }\n    }\n\n    /// Called when a download has finished.\n    ///\n    /// - Parameters:\n    ///   - task:   `URLSessionTask` that finished the download.\n    ///   - result: `Result` of the automatic move to `destination`.\n    func didFinishDownloading(using task: URLSessionTask, with result: Result<URL, AFError>) {\n        eventMonitor?.request(self, didFinishDownloadingUsing: task, with: result)\n\n        switch result {\n        case let .success(url): protectedDownloadMutableState.write { $0.fileURL = url }\n        case let .failure(error): self.error = error\n        }\n    }\n\n    /// Updates the `downloadProgress` using the provided values.\n    ///\n    /// - Parameters:\n    ///   - bytesWritten:              Total bytes written so far.\n    ///   - totalBytesExpectedToWrite: Total bytes expected to write.\n    func updateDownloadProgress(bytesWritten: Int64, totalBytesExpectedToWrite: Int64) {\n        downloadProgress.totalUnitCount = totalBytesExpectedToWrite\n        downloadProgress.completedUnitCount += bytesWritten\n\n        downloadProgressHandler?.queue.async { self.downloadProgressHandler?.handler(self.downloadProgress) }\n    }\n\n    override func task(for request: URLRequest, using session: URLSession) -> URLSessionTask {\n        return session.downloadTask(with: request)\n    }\n\n    /// Creates a `URLSessionTask` from the provided resume data.\n    ///\n    /// - Parameters:\n    ///   - data:    `Data` used to resume the download.\n    ///   - session: `URLSession` used to create the `URLSessionTask`.\n    ///\n    /// - Returns:   The `URLSessionTask` created.\n    public func task(forResumeData data: Data, using session: URLSession) -> URLSessionTask {\n        return session.downloadTask(withResumeData: data)\n    }\n\n    /// Cancels the instance. Once cancelled, a `DownloadRequest` can no longer be resumed or suspended.\n    ///\n    /// - Note: This method will NOT produce resume data. If you wish to cancel and produce resume data, use\n    ///         `cancel(producingResumeData:)` or `cancel(byProducingResumeData:)`.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    public override func cancel() -> Self {\n        return cancel(producingResumeData: false)\n    }\n\n    /// Cancels the instance, optionally producing resume data. Once cancelled, a `DownloadRequest` can no longer be\n    /// resumed or suspended.\n    ///\n    /// - Note: If `producingResumeData` is `true`, the `resumeData` property will be populated with any resume data, if\n    ///         available.\n    ///\n    /// - Returns: The instance.\n    @discardableResult\n    public func cancel(producingResumeData shouldProduceResumeData: Bool) -> Self {\n        return cancel(optionallyProducingResumeData: shouldProduceResumeData ? { _ in } : nil)\n    }\n\n    /// Cancels the instance while producing resume data. Once cancelled, a `DownloadRequest` can no longer be resumed\n    /// or suspended.\n    ///\n    /// - Note: The resume data passed to the completion handler will also be available on the instance's `resumeData`\n    ///         property.\n    ///\n    /// - Parameter completionHandler: The completion handler that is called when the download has been successfully\n    ///                                cancelled. It is not guaranteed to be called on a particular queue, so you may\n    ///                                want use an appropriate queue to perform your work.\n    ///\n    /// - Returns:                     The instance.\n    @discardableResult\n    public func cancel(byProducingResumeData completionHandler: @escaping (_ data: Data?) -> Void) -> Self {\n        return cancel(optionallyProducingResumeData: completionHandler)\n    }\n\n    /// Internal implementation of cancellation that optionally takes a resume data handler. If no handler is passed,\n    /// cancellation is performed without producing resume data.\n    ///\n    /// - Parameter completionHandler: Optional resume data handler.\n    ///\n    /// - Returns:                     The instance.\n    private func cancel(optionallyProducingResumeData completionHandler: ((_ resumeData: Data?) -> Void)?) -> Self {\n        protectedMutableState.write { mutableState in\n            guard mutableState.state.canTransitionTo(.cancelled) else { return }\n\n            mutableState.state = .cancelled\n\n            underlyingQueue.async { self.didCancel() }\n\n            guard let task = mutableState.tasks.last as? URLSessionDownloadTask, task.state != .completed else {\n                underlyingQueue.async { self.finish() }\n                return\n            }\n\n            if let completionHandler = completionHandler {\n                // Resume to ensure metrics are gathered.\n                task.resume()\n                task.cancel { resumeData in\n                    self.protectedDownloadMutableState.write { $0.resumeData = resumeData }\n                    self.underlyingQueue.async { self.didCancelTask(task) }\n                    completionHandler(resumeData)\n                }\n            } else {\n                // Resume to ensure metrics are gathered.\n                task.resume()\n                task.cancel()\n                self.underlyingQueue.async { self.didCancelTask(task) }\n            }\n        }\n\n        return self\n    }\n\n    /// Validates the request, using the specified closure.\n    ///\n    /// - Note: If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - Parameter validation: `Validation` closure to validate the response.\n    ///\n    /// - Returns:              The instance.\n    @discardableResult\n    public func validate(_ validation: @escaping Validation) -> Self {\n        let validator: () -> Void = { [unowned self] in\n            guard self.error == nil, let response = self.response else { return }\n\n            let result = validation(self.request, response, self.fileURL)\n\n            if case let .failure(error) = result { self.error = error.asAFError(or: .responseValidationFailed(reason: .customValidationFailed(error: error))) }\n\n            self.eventMonitor?.request(self,\n                                       didValidateRequest: self.request,\n                                       response: response,\n                                       fileURL: self.fileURL,\n                                       withResult: result)\n        }\n\n        protectedValidators.append(validator)\n\n        return self\n    }\n}\n\n// MARK: - UploadRequest\n\n/// `DataRequest` subclass which handles `Data` upload from memory, file, or stream using `URLSessionUploadTask`.\npublic class UploadRequest: DataRequest {\n    /// Type describing the origin of the upload, whether `Data`, file, or stream.\n    public enum Uploadable {\n        /// Upload from the provided `Data` value.\n        case data(Data)\n        /// Upload from the provided file `URL`, as well as a `Bool` determining whether the source file should be\n        /// automatically removed once uploaded.\n        case file(URL, shouldRemove: Bool)\n        /// Upload from the provided `InputStream`.\n        case stream(InputStream)\n    }\n\n    // MARK: Initial State\n\n    /// The `UploadableConvertible` value used to produce the `Uploadable` value for this instance.\n    public let upload: UploadableConvertible\n\n    /// `FileManager` used to perform cleanup tasks, including the removal of multipart form encoded payloads written\n    /// to disk.\n    public let fileManager: FileManager\n\n    // MARK: Mutable State\n\n    /// `Uploadable` value used by the instance.\n    public var uploadable: Uploadable?\n\n    /// Creates an `UploadRequest` using the provided parameters.\n    ///\n    /// - Parameters:\n    ///   - id:                 `UUID` used for the `Hashable` and `Equatable` implementations. `UUID()` by default.\n    ///   - convertible:        `UploadConvertible` value used to determine the type of upload to be performed.\n    ///   - underlyingQueue:    `DispatchQueue` on which all internal `Request` work is performed.\n    ///   - serializationQueue: `DispatchQueue` on which all serialization work is performed. By default targets\n    ///                         `underlyingQueue`, but can be passed another queue from a `Session`.\n    ///   - eventMonitor:       `EventMonitor` called for event callbacks from internal `Request` actions.\n    ///   - interceptor:        `RequestInterceptor` used throughout the request lifecycle.\n    ///   - delegate:           `RequestDelegate` that provides an interface to actions not performed by the `Request`.\n    init(id: UUID = UUID(),\n         convertible: UploadConvertible,\n         underlyingQueue: DispatchQueue,\n         serializationQueue: DispatchQueue,\n         eventMonitor: EventMonitor?,\n         interceptor: RequestInterceptor?,\n         fileManager: FileManager,\n         delegate: RequestDelegate) {\n        upload = convertible\n        self.fileManager = fileManager\n\n        super.init(id: id,\n                   convertible: convertible,\n                   underlyingQueue: underlyingQueue,\n                   serializationQueue: serializationQueue,\n                   eventMonitor: eventMonitor,\n                   interceptor: interceptor,\n                   delegate: delegate)\n    }\n\n    /// Called when the `Uploadable` value has been created from the `UploadConvertible`.\n    ///\n    /// - Parameter uploadable: The `Uploadable` that was created.\n    func didCreateUploadable(_ uploadable: Uploadable) {\n        self.uploadable = uploadable\n\n        eventMonitor?.request(self, didCreateUploadable: uploadable)\n    }\n\n    /// Called when the `Uploadable` value could not be created.\n    ///\n    /// - Parameter error: `AFError` produced by the failure.\n    func didFailToCreateUploadable(with error: AFError) {\n        self.error = error\n\n        eventMonitor?.request(self, didFailToCreateUploadableWithError: error)\n\n        retryOrFinish(error: error)\n    }\n\n    override func task(for request: URLRequest, using session: URLSession) -> URLSessionTask {\n        guard let uploadable = uploadable else {\n            fatalError(\"Attempting to create a URLSessionUploadTask when Uploadable value doesn't exist.\")\n        }\n\n        switch uploadable {\n        case let .data(data): return session.uploadTask(with: request, from: data)\n        case let .file(url, _): return session.uploadTask(with: request, fromFile: url)\n        case .stream: return session.uploadTask(withStreamedRequest: request)\n        }\n    }\n\n    /// Produces the `InputStream` from `uploadable`, if it can.\n    ///\n    /// - Note: Calling this method with a non-`.stream` `Uploadable` is a logic error and will crash.\n    ///\n    /// - Returns: The `InputStream`.\n    func inputStream() -> InputStream {\n        guard let uploadable = uploadable else {\n            fatalError(\"Attempting to access the input stream but the uploadable doesn't exist.\")\n        }\n\n        guard case let .stream(stream) = uploadable else {\n            fatalError(\"Attempted to access the stream of an UploadRequest that wasn't created with one.\")\n        }\n\n        eventMonitor?.request(self, didProvideInputStream: stream)\n\n        return stream\n    }\n\n    public override func cleanup() {\n        defer { super.cleanup() }\n\n        guard\n            let uploadable = self.uploadable,\n            case let .file(url, shouldRemove) = uploadable,\n            shouldRemove\n        else { return }\n\n        try? fileManager.removeItem(at: url)\n    }\n}\n\n/// A type that can produce an `UploadRequest.Uploadable` value.\npublic protocol UploadableConvertible {\n    /// Produces an `UploadRequest.Uploadable` value from the instance.\n    ///\n    /// - Returns: The `UploadRequest.Uploadable`.\n    /// - Throws:  Any `Error` produced during creation.\n    func createUploadable() throws -> UploadRequest.Uploadable\n}\n\nextension UploadRequest.Uploadable: UploadableConvertible {\n    public func createUploadable() throws -> UploadRequest.Uploadable {\n        return self\n    }\n}\n\n/// A type that can be converted to an upload, whether from an `UploadRequest.Uploadable` or `URLRequestConvertible`.\npublic protocol UploadConvertible: UploadableConvertible & URLRequestConvertible {}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/RequestInterceptor.swift",
    "content": "//\n//  RequestInterceptor.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A type that can inspect and optionally adapt a `URLRequest` in some manner if necessary.\npublic protocol RequestAdapter {\n    /// Inspects and adapts the specified `URLRequest` in some manner and calls the completion handler with the Result.\n    ///\n    /// - Parameters:\n    ///   - urlRequest: The `URLRequest` to adapt.\n    ///   - session:    The `Session` that will execute the `URLRequest`.\n    ///   - completion: The completion handler that must be called when adaptation is complete.\n    func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void)\n}\n\n// MARK: -\n\n/// Outcome of determination whether retry is necessary.\npublic enum RetryResult {\n    /// Retry should be attempted immediately.\n    case retry\n    /// Retry should be attempted after the associated `TimeInterval`.\n    case retryWithDelay(TimeInterval)\n    /// Do not retry.\n    case doNotRetry\n    /// Do not retry due to the associated `Error`.\n    case doNotRetryWithError(Error)\n}\n\nextension RetryResult {\n    var retryRequired: Bool {\n        switch self {\n        case .retry, .retryWithDelay: return true\n        default: return false\n        }\n    }\n\n    var delay: TimeInterval? {\n        switch self {\n        case let .retryWithDelay(delay): return delay\n        default: return nil\n        }\n    }\n\n    var error: Error? {\n        guard case let .doNotRetryWithError(error) = self else { return nil }\n        return error\n    }\n}\n\n/// A type that determines whether a request should be retried after being executed by the specified session manager\n/// and encountering an error.\npublic protocol RequestRetrier {\n    /// Determines whether the `Request` should be retried by calling the `completion` closure.\n    ///\n    /// This operation is fully asynchronous. Any amount of time can be taken to determine whether the request needs\n    /// to be retried. The one requirement is that the completion closure is called to ensure the request is properly\n    /// cleaned up after.\n    ///\n    /// - Parameters:\n    ///   - request:    `Request` that failed due to the provided `Error`.\n    ///   - session:    `Session` that produced the `Request`.\n    ///   - error:      `Error` encountered while executing the `Request`.\n    ///   - completion: Completion closure to be executed when a retry decision has been determined.\n    func retry(_ request: Request, for session: Session, dueTo error: Error, completion: @escaping (RetryResult) -> Void)\n}\n\n// MARK: -\n\n/// Type that provides both `RequestAdapter` and `RequestRetrier` functionality.\npublic protocol RequestInterceptor: RequestAdapter, RequestRetrier {}\n\nextension RequestInterceptor {\n    public func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        completion(.success(urlRequest))\n    }\n\n    public func retry(_ request: Request,\n                      for session: Session,\n                      dueTo error: Error,\n                      completion: @escaping (RetryResult) -> Void) {\n        completion(.doNotRetry)\n    }\n}\n\n/// `RequestAdapter` closure definition.\npublic typealias AdaptHandler = (URLRequest, Session, _ completion: @escaping (Result<URLRequest, Error>) -> Void) -> Void\n/// `RequestRetrier` closure definition.\npublic typealias RetryHandler = (Request, Session, Error, _ completion: @escaping (RetryResult) -> Void) -> Void\n\n// MARK: -\n\n/// Closure-based `RequestAdapter`.\nopen class Adapter: RequestInterceptor {\n    private let adaptHandler: AdaptHandler\n\n    /// Creates an instance using the provided closure.\n    ///\n    /// - Parameter adaptHandler: `AdaptHandler` closure to be executed when handling request adaptation.\n    public init(_ adaptHandler: @escaping AdaptHandler) {\n        self.adaptHandler = adaptHandler\n    }\n\n    open func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        adaptHandler(urlRequest, session, completion)\n    }\n}\n\n// MARK: -\n\n/// Closure-based `RequestRetrier`.\nopen class Retrier: RequestInterceptor {\n    private let retryHandler: RetryHandler\n\n    /// Creates an instance using the provided closure.\n    ///\n    /// - Parameter retryHandler: `RetryHandler` closure to be executed when handling request retry.\n    public init(_ retryHandler: @escaping RetryHandler) {\n        self.retryHandler = retryHandler\n    }\n\n    open func retry(_ request: Request,\n                    for session: Session,\n                    dueTo error: Error,\n                    completion: @escaping (RetryResult) -> Void) {\n        retryHandler(request, session, error, completion)\n    }\n}\n\n// MARK: -\n\n/// `RequestInterceptor` which can use multiple `RequestAdapter` and `RequestRetrier` values.\nopen class Interceptor: RequestInterceptor {\n    /// All `RequestAdapter`s associated with the instance. These adapters will be run until one fails.\n    public let adapters: [RequestAdapter]\n    /// All `RequestRetrier`s associated with the instance. These retriers will be run one at a time until one triggers retry.\n    public let retriers: [RequestRetrier]\n\n    /// Creates an instance from `AdaptHandler` and `RetryHandler` closures.\n    ///\n    /// - Parameters:\n    ///   - adaptHandler: `AdaptHandler` closure to be used.\n    ///   - retryHandler: `RetryHandler` closure to be used.\n    public init(adaptHandler: @escaping AdaptHandler, retryHandler: @escaping RetryHandler) {\n        adapters = [Adapter(adaptHandler)]\n        retriers = [Retrier(retryHandler)]\n    }\n\n    /// Creates an instance from `RequestAdapter` and `RequestRetrier` values.\n    ///\n    /// - Parameters:\n    ///   - adapter: `RequestAdapter` value to be used.\n    ///   - retrier: `RequestRetrier` value to be used.\n    public init(adapter: RequestAdapter, retrier: RequestRetrier) {\n        adapters = [adapter]\n        retriers = [retrier]\n    }\n\n    /// Creates an instance from the arrays of `RequestAdapter` and `RequestRetrier` values.\n    ///\n    /// - Parameters:\n    ///   - adapters: `RequestAdapter` values to be used.\n    ///   - retriers: `RequestRetrier` values to be used.\n    public init(adapters: [RequestAdapter] = [], retriers: [RequestRetrier] = []) {\n        self.adapters = adapters\n        self.retriers = retriers\n    }\n\n    open func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        adapt(urlRequest, for: session, using: adapters, completion: completion)\n    }\n\n    private func adapt(_ urlRequest: URLRequest,\n                       for session: Session,\n                       using adapters: [RequestAdapter],\n                       completion: @escaping (Result<URLRequest, Error>) -> Void) {\n        var pendingAdapters = adapters\n\n        guard !pendingAdapters.isEmpty else { completion(.success(urlRequest)); return }\n\n        let adapter = pendingAdapters.removeFirst()\n\n        adapter.adapt(urlRequest, for: session) { result in\n            switch result {\n            case let .success(urlRequest):\n                self.adapt(urlRequest, for: session, using: pendingAdapters, completion: completion)\n            case .failure:\n                completion(result)\n            }\n        }\n    }\n\n    open func retry(_ request: Request,\n                    for session: Session,\n                    dueTo error: Error,\n                    completion: @escaping (RetryResult) -> Void) {\n        retry(request, for: session, dueTo: error, using: retriers, completion: completion)\n    }\n\n    private func retry(_ request: Request,\n                       for session: Session,\n                       dueTo error: Error,\n                       using retriers: [RequestRetrier],\n                       completion: @escaping (RetryResult) -> Void) {\n        var pendingRetriers = retriers\n\n        guard !pendingRetriers.isEmpty else { completion(.doNotRetry); return }\n\n        let retrier = pendingRetriers.removeFirst()\n\n        retrier.retry(request, for: session, dueTo: error) { result in\n            switch result {\n            case .retry, .retryWithDelay, .doNotRetryWithError:\n                completion(result)\n            case .doNotRetry:\n                // Only continue to the next retrier if retry was not triggered and no error was encountered\n                self.retry(request, for: session, dueTo: error, using: pendingRetriers, completion: completion)\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/RequestTaskMap.swift",
    "content": "//\n//  RequestTaskMap.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A type that maintains a two way, one to one map of `URLSessionTask`s to `Request`s.\nstruct RequestTaskMap {\n    private var tasksToRequests: [URLSessionTask: Request]\n    private var requestsToTasks: [Request: URLSessionTask]\n    private var taskEvents: [URLSessionTask: (completed: Bool, metricsGathered: Bool)]\n\n    var requests: [Request] {\n        return Array(tasksToRequests.values)\n    }\n\n    init(tasksToRequests: [URLSessionTask: Request] = [:],\n         requestsToTasks: [Request: URLSessionTask] = [:],\n         taskEvents: [URLSessionTask: (completed: Bool, metricsGathered: Bool)] = [:]) {\n        self.tasksToRequests = tasksToRequests\n        self.requestsToTasks = requestsToTasks\n        self.taskEvents = taskEvents\n    }\n\n    subscript(_ request: Request) -> URLSessionTask? {\n        get { return requestsToTasks[request] }\n        set {\n            guard let newValue = newValue else {\n                guard let task = requestsToTasks[request] else {\n                    fatalError(\"RequestTaskMap consistency error: no task corresponding to request found.\")\n                }\n\n                requestsToTasks.removeValue(forKey: request)\n                tasksToRequests.removeValue(forKey: task)\n                taskEvents.removeValue(forKey: task)\n\n                return\n            }\n\n            requestsToTasks[request] = newValue\n            tasksToRequests[newValue] = request\n            taskEvents[newValue] = (completed: false, metricsGathered: false)\n        }\n    }\n\n    subscript(_ task: URLSessionTask) -> Request? {\n        get { return tasksToRequests[task] }\n        set {\n            guard let newValue = newValue else {\n                guard let request = tasksToRequests[task] else {\n                    fatalError(\"RequestTaskMap consistency error: no request corresponding to task found.\")\n                }\n\n                tasksToRequests.removeValue(forKey: task)\n                requestsToTasks.removeValue(forKey: request)\n                taskEvents.removeValue(forKey: task)\n\n                return\n            }\n\n            tasksToRequests[task] = newValue\n            requestsToTasks[newValue] = task\n            taskEvents[task] = (completed: false, metricsGathered: false)\n        }\n    }\n\n    var count: Int {\n        precondition(tasksToRequests.count == requestsToTasks.count,\n                     \"RequestTaskMap.count invalid, requests.count: \\(tasksToRequests.count) != tasks.count: \\(requestsToTasks.count)\")\n\n        return tasksToRequests.count\n    }\n\n    var eventCount: Int {\n        precondition(taskEvents.count == count, \"RequestTaskMap.eventCount invalid, count: \\(count) != taskEvents.count: \\(taskEvents.count)\")\n\n        return taskEvents.count\n    }\n\n    var isEmpty: Bool {\n        precondition(tasksToRequests.isEmpty == requestsToTasks.isEmpty,\n                     \"RequestTaskMap.isEmpty invalid, requests.isEmpty: \\(tasksToRequests.isEmpty) != tasks.isEmpty: \\(requestsToTasks.isEmpty)\")\n\n        return tasksToRequests.isEmpty\n    }\n\n    var isEventsEmpty: Bool {\n        precondition(taskEvents.isEmpty == isEmpty, \"RequestTaskMap.isEventsEmpty invalid, isEmpty: \\(isEmpty) != taskEvents.isEmpty: \\(taskEvents.isEmpty)\")\n\n        return taskEvents.isEmpty\n    }\n\n    mutating func disassociateIfNecessaryAfterGatheringMetricsForTask(_ task: URLSessionTask) {\n        guard let events = taskEvents[task] else {\n            fatalError(\"RequestTaskMap consistency error: no events corresponding to task found.\")\n        }\n\n        switch (events.completed, events.metricsGathered) {\n        case (_, true): fatalError(\"RequestTaskMap consistency error: duplicate metricsGatheredForTask call.\")\n        case (false, false): taskEvents[task] = (completed: false, metricsGathered: true)\n        case (true, false): self[task] = nil\n        }\n    }\n\n    mutating func disassociateIfNecessaryAfterCompletingTask(_ task: URLSessionTask) {\n        guard let events = taskEvents[task] else {\n            fatalError(\"RequestTaskMap consistency error: no events corresponding to task found.\")\n        }\n\n        switch (events.completed, events.metricsGathered) {\n        case (true, _): fatalError(\"RequestTaskMap consistency error: duplicate completionReceivedForTask call.\")\n        case (false, false): taskEvents[task] = (completed: true, metricsGathered: false)\n        case (false, true): self[task] = nil\n        }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/Response.swift",
    "content": "//\n//  Response.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Default type of `DataResponse` returned by Alamofire, with an `AFError` `Failure` type.\npublic typealias AFDataResponse<Success> = DataResponse<Success, AFError>\n/// Default type of `DownloadResponse` returned by Alamofire, with an `AFError` `Failure` type.\npublic typealias AFDownloadResponse<Success> = DownloadResponse<Success, AFError>\n\n/// Type used to store all values associated with a serialized response of a `DataRequest` or `UploadRequest`.\npublic struct DataResponse<Success, Failure: Error> {\n    /// The URL request sent to the server.\n    public let request: URLRequest?\n\n    /// The server's response to the URL request.\n    public let response: HTTPURLResponse?\n\n    /// The data returned by the server.\n    public let data: Data?\n\n    /// The final metrics of the response.\n    public let metrics: URLSessionTaskMetrics?\n\n    /// The time taken to serialize the response.\n    public let serializationDuration: TimeInterval\n\n    /// The result of response serialization.\n    public let result: Result<Success, Failure>\n\n    /// Returns the associated value of the result if it is a success, `nil` otherwise.\n    public var value: Success? { return result.success }\n\n    /// Returns the associated error value if the result if it is a failure, `nil` otherwise.\n    public var error: Failure? { return result.failure }\n\n    /// Creates a `DataResponse` instance with the specified parameters derived from the response serialization.\n    ///\n    /// - Parameters:\n    ///   - request:               The `URLRequest` sent to the server.\n    ///   - response:              The `HTTPURLResponse` from the server.\n    ///   - data:                  The `Data` returned by the server.\n    ///   - metrics:               The `URLSessionTaskMetrics` of the `DataRequest` or `UploadRequest`.\n    ///   - serializationDuration: The duration taken by serialization.\n    ///   - result:                The `Result` of response serialization.\n    public init(request: URLRequest?,\n                response: HTTPURLResponse?,\n                data: Data?,\n                metrics: URLSessionTaskMetrics?,\n                serializationDuration: TimeInterval,\n                result: Result<Success, Failure>) {\n        self.request = request\n        self.response = response\n        self.data = data\n        self.metrics = metrics\n        self.serializationDuration = serializationDuration\n        self.result = result\n    }\n}\n\n// MARK: -\n\nextension DataResponse: CustomStringConvertible, CustomDebugStringConvertible {\n    /// The textual representation used when written to an output stream, which includes whether the result was a\n    /// success or failure.\n    public var description: String {\n        return \"\\(result)\"\n    }\n\n    /// The debug textual representation used when written to an output stream, which includes the URL request, the URL\n    /// response, the server data, the duration of the network and serialization actions, and the response serialization\n    /// result.\n    public var debugDescription: String {\n        let requestDescription = request.map { \"\\($0.httpMethod!) \\($0)\" } ?? \"nil\"\n        let requestBody = request?.httpBody.map { String(decoding: $0, as: UTF8.self) } ?? \"None\"\n        let responseDescription = response.map { response in\n            let sortedHeaders = response.headers.sorted()\n\n            return \"\"\"\n            [Status Code]: \\(response.statusCode)\n            [Headers]:\n            \\(sortedHeaders)\n            \"\"\"\n        } ?? \"nil\"\n        let responseBody = data.map { String(decoding: $0, as: UTF8.self) } ?? \"None\"\n        let metricsDescription = metrics.map { \"\\($0.taskInterval.duration)s\" } ?? \"None\"\n\n        return \"\"\"\n        [Request]: \\(requestDescription)\n        [Request Body]: \\n\\(requestBody)\n        [Response]: \\n\\(responseDescription)\n        [Response Body]: \\n\\(responseBody)\n        [Data]: \\(data?.description ?? \"None\")\n        [Network Duration]: \\(metricsDescription)\n        [Serialization Duration]: \\(serializationDuration)s\n        [Result]: \\(result)\n        \"\"\"\n    }\n}\n\n// MARK: -\n\nextension DataResponse {\n    /// Evaluates the specified closure when the result of this `DataResponse` is a success, passing the unwrapped\n    /// result value as a parameter.\n    ///\n    /// Use the `map` method with a closure that does not throw. For example:\n    ///\n    ///     let possibleData: DataResponse<Data> = ...\n    ///     let possibleInt = possibleData.map { $0.count }\n    ///\n    /// - parameter transform: A closure that takes the success value of the instance's result.\n    ///\n    /// - returns: A `DataResponse` whose result wraps the value returned by the given closure. If this instance's\n    ///            result is a failure, returns a response wrapping the same failure.\n    public func map<NewSuccess>(_ transform: (Success) -> NewSuccess) -> DataResponse<NewSuccess, Failure> {\n        return DataResponse<NewSuccess, Failure>(request: request,\n                                                 response: response,\n                                                 data: data,\n                                                 metrics: metrics,\n                                                 serializationDuration: serializationDuration,\n                                                 result: result.map(transform))\n    }\n\n    /// Evaluates the given closure when the result of this `DataResponse` is a success, passing the unwrapped result\n    /// value as a parameter.\n    ///\n    /// Use the `tryMap` method with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: DataResponse<Data> = ...\n    ///     let possibleObject = possibleData.tryMap {\n    ///         try JSONSerialization.jsonObject(with: $0)\n    ///     }\n    ///\n    /// - parameter transform: A closure that takes the success value of the instance's result.\n    ///\n    /// - returns: A success or failure `DataResponse` depending on the result of the given closure. If this instance's\n    ///            result is a failure, returns the same failure.\n    public func tryMap<NewSuccess>(_ transform: (Success) throws -> NewSuccess) -> DataResponse<NewSuccess, Error> {\n        return DataResponse<NewSuccess, Error>(request: request,\n                                               response: response,\n                                               data: data,\n                                               metrics: metrics,\n                                               serializationDuration: serializationDuration,\n                                               result: result.tryMap(transform))\n    }\n\n    /// Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter.\n    ///\n    /// Use the `mapError` function with a closure that does not throw. For example:\n    ///\n    ///     let possibleData: DataResponse<Data> = ...\n    ///     let withMyError = possibleData.mapError { MyError.error($0) }\n    ///\n    /// - Parameter transform: A closure that takes the error of the instance.\n    ///\n    /// - Returns: A `DataResponse` instance containing the result of the transform.\n    public func mapError<NewFailure: Error>(_ transform: (Failure) -> NewFailure) -> DataResponse<Success, NewFailure> {\n        return DataResponse<Success, NewFailure>(request: request,\n                                                 response: response,\n                                                 data: data,\n                                                 metrics: metrics,\n                                                 serializationDuration: serializationDuration,\n                                                 result: result.mapError(transform))\n    }\n\n    /// Evaluates the specified closure when the `DataResponse` is a failure, passing the unwrapped error as a parameter.\n    ///\n    /// Use the `tryMapError` function with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: DataResponse<Data> = ...\n    ///     let possibleObject = possibleData.tryMapError {\n    ///         try someFailableFunction(taking: $0)\n    ///     }\n    ///\n    /// - Parameter transform: A throwing closure that takes the error of the instance.\n    ///\n    /// - Returns: A `DataResponse` instance containing the result of the transform.\n    public func tryMapError<NewFailure: Error>(_ transform: (Failure) throws -> NewFailure) -> DataResponse<Success, Error> {\n        return DataResponse<Success, Error>(request: request,\n                                            response: response,\n                                            data: data,\n                                            metrics: metrics,\n                                            serializationDuration: serializationDuration,\n                                            result: result.tryMapError(transform))\n    }\n}\n\n// MARK: -\n\n/// Used to store all data associated with a serialized response of a download request.\npublic struct DownloadResponse<Success, Failure: Error> {\n    /// The URL request sent to the server.\n    public let request: URLRequest?\n\n    /// The server's response to the URL request.\n    public let response: HTTPURLResponse?\n\n    /// The final destination URL of the data returned from the server after it is moved.\n    public let fileURL: URL?\n\n    /// The resume data generated if the request was cancelled.\n    public let resumeData: Data?\n\n    /// The final metrics of the response.\n    public let metrics: URLSessionTaskMetrics?\n\n    /// The time taken to serialize the response.\n    public let serializationDuration: TimeInterval\n\n    /// The result of response serialization.\n    public let result: Result<Success, Failure>\n\n    /// Returns the associated value of the result if it is a success, `nil` otherwise.\n    public var value: Success? { return result.success }\n\n    /// Returns the associated error value if the result if it is a failure, `nil` otherwise.\n    public var error: Failure? { return result.failure }\n\n    /// Creates a `DownloadResponse` instance with the specified parameters derived from response serialization.\n    ///\n    /// - Parameters:\n    ///   - request:               The `URLRequest` sent to the server.\n    ///   - response:              The `HTTPURLResponse` from the server.\n    ///   - temporaryURL:          The temporary destination `URL` of the data returned from the server.\n    ///   - destinationURL:        The final destination `URL` of the data returned from the server, if it was moved.\n    ///   - resumeData:            The resume `Data` generated if the request was cancelled.\n    ///   - metrics:               The `URLSessionTaskMetrics` of the `DownloadRequest`.\n    ///   - serializationDuration: The duration taken by serialization.\n    ///   - result:                The `Result` of response serialization.\n    public init(request: URLRequest?,\n                response: HTTPURLResponse?,\n                fileURL: URL?,\n                resumeData: Data?,\n                metrics: URLSessionTaskMetrics?,\n                serializationDuration: TimeInterval,\n                result: Result<Success, Failure>) {\n        self.request = request\n        self.response = response\n        self.fileURL = fileURL\n        self.resumeData = resumeData\n        self.metrics = metrics\n        self.serializationDuration = serializationDuration\n        self.result = result\n    }\n}\n\n// MARK: -\n\nextension DownloadResponse: CustomStringConvertible, CustomDebugStringConvertible {\n    /// The textual representation used when written to an output stream, which includes whether the result was a\n    /// success or failure.\n    public var description: String {\n        return \"\\(result)\"\n    }\n\n    /// The debug textual representation used when written to an output stream, which includes the URL request, the URL\n    /// response, the temporary and destination URLs, the resume data, the durations of the network and serialization\n    /// actions, and the response serialization result.\n    public var debugDescription: String {\n        let requestDescription = request.map { \"\\($0.httpMethod!) \\($0)\" } ?? \"nil\"\n        let requestBody = request?.httpBody.map { String(decoding: $0, as: UTF8.self) } ?? \"None\"\n        let responseDescription = response.map { response in\n            let sortedHeaders = response.headers.sorted()\n\n            return \"\"\"\n            [Status Code]: \\(response.statusCode)\n            [Headers]:\n            \\(sortedHeaders)\n            \"\"\"\n        } ?? \"nil\"\n        let metricsDescription = metrics.map { \"\\($0.taskInterval.duration)s\" } ?? \"None\"\n        let resumeDataDescription = resumeData.map { \"\\($0)\" } ?? \"None\"\n\n        return \"\"\"\n        [Request]: \\(requestDescription)\n        [Request Body]: \\n\\(requestBody)\n        [Response]: \\n\\(responseDescription)\n        [File URL]: \\(fileURL?.path ?? \"nil\")\n        [ResumeData]: \\(resumeDataDescription)\n        [Network Duration]: \\(metricsDescription)\n        [Serialization Duration]: \\(serializationDuration)s\n        [Result]: \\(result)\n        \"\"\"\n    }\n}\n\n// MARK: -\n\nextension DownloadResponse {\n    /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped\n    /// result value as a parameter.\n    ///\n    /// Use the `map` method with a closure that does not throw. For example:\n    ///\n    ///     let possibleData: DownloadResponse<Data> = ...\n    ///     let possibleInt = possibleData.map { $0.count }\n    ///\n    /// - parameter transform: A closure that takes the success value of the instance's result.\n    ///\n    /// - returns: A `DownloadResponse` whose result wraps the value returned by the given closure. If this instance's\n    ///            result is a failure, returns a response wrapping the same failure.\n    public func map<NewSuccess>(_ transform: (Success) -> NewSuccess) -> DownloadResponse<NewSuccess, Failure> {\n        return DownloadResponse<NewSuccess, Failure>(request: request,\n                                                     response: response,\n                                                     fileURL: fileURL,\n                                                     resumeData: resumeData,\n                                                     metrics: metrics,\n                                                     serializationDuration: serializationDuration,\n                                                     result: result.map(transform))\n    }\n\n    /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped\n    /// result value as a parameter.\n    ///\n    /// Use the `tryMap` method with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: DownloadResponse<Data> = ...\n    ///     let possibleObject = possibleData.tryMap {\n    ///         try JSONSerialization.jsonObject(with: $0)\n    ///     }\n    ///\n    /// - parameter transform: A closure that takes the success value of the instance's result.\n    ///\n    /// - returns: A success or failure `DownloadResponse` depending on the result of the given closure. If this\n    /// instance's result is a failure, returns the same failure.\n    public func tryMap<NewSuccess>(_ transform: (Success) throws -> NewSuccess) -> DownloadResponse<NewSuccess, Error> {\n        return DownloadResponse<NewSuccess, Error>(request: request,\n                                                   response: response,\n                                                   fileURL: fileURL,\n                                                   resumeData: resumeData,\n                                                   metrics: metrics,\n                                                   serializationDuration: serializationDuration,\n                                                   result: result.tryMap(transform))\n    }\n\n    /// Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter.\n    ///\n    /// Use the `mapError` function with a closure that does not throw. For example:\n    ///\n    ///     let possibleData: DownloadResponse<Data> = ...\n    ///     let withMyError = possibleData.mapError { MyError.error($0) }\n    ///\n    /// - Parameter transform: A closure that takes the error of the instance.\n    ///\n    /// - Returns: A `DownloadResponse` instance containing the result of the transform.\n    public func mapError<NewFailure: Error>(_ transform: (Failure) -> NewFailure) -> DownloadResponse<Success, NewFailure> {\n        return DownloadResponse<Success, NewFailure>(request: request,\n                                                     response: response,\n                                                     fileURL: fileURL,\n                                                     resumeData: resumeData,\n                                                     metrics: metrics,\n                                                     serializationDuration: serializationDuration,\n                                                     result: result.mapError(transform))\n    }\n\n    /// Evaluates the specified closure when the `DownloadResponse` is a failure, passing the unwrapped error as a parameter.\n    ///\n    /// Use the `tryMapError` function with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: DownloadResponse<Data> = ...\n    ///     let possibleObject = possibleData.tryMapError {\n    ///         try someFailableFunction(taking: $0)\n    ///     }\n    ///\n    /// - Parameter transform: A throwing closure that takes the error of the instance.\n    ///\n    /// - Returns: A `DownloadResponse` instance containing the result of the transform.\n    public func tryMapError<NewFailure: Error>(_ transform: (Failure) throws -> NewFailure) -> DownloadResponse<Success, Error> {\n        return DownloadResponse<Success, Error>(request: request,\n                                                response: response,\n                                                fileURL: fileURL,\n                                                resumeData: resumeData,\n                                                metrics: metrics,\n                                                serializationDuration: serializationDuration,\n                                                result: result.tryMapError(transform))\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/ResponseSerialization.swift",
    "content": "//\n//  ResponseSerialization.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n// MARK: Protocols\n\n/// The type to which all data response serializers must conform in order to serialize a response.\npublic protocol DataResponseSerializerProtocol {\n    /// The type of serialized object to be created.\n    associatedtype SerializedObject\n\n    /// Serialize the response `Data` into the provided type..\n    ///\n    /// - Parameters:\n    ///   - request:  `URLRequest` which was used to perform the request, if any.\n    ///   - response: `HTTPURLResponse` received from the server, if any.\n    ///   - data:     `Data` returned from the server, if any.\n    ///   - error:    `Error` produced by Alamofire or the underlying `URLSession` during the request.\n    ///\n    /// - Returns:    The `SerializedObject`.\n    /// - Throws:     Any `Error` produced during serialization.\n    func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> SerializedObject\n}\n\n/// The type to which all download response serializers must conform in order to serialize a response.\npublic protocol DownloadResponseSerializerProtocol {\n    /// The type of serialized object to be created.\n    associatedtype SerializedObject\n\n    /// Serialize the downloaded response `Data` from disk into the provided type..\n    ///\n    /// - Parameters:\n    ///   - request:  `URLRequest` which was used to perform the request, if any.\n    ///   - response: `HTTPURLResponse` received from the server, if any.\n    ///   - fileURL:  File `URL` to which the response data was downloaded.\n    ///   - error:    `Error` produced by Alamofire or the underlying `URLSession` during the request.\n    ///\n    /// - Returns:    The `SerializedObject`.\n    /// - Throws:     Any `Error` produced during serialization.\n    func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> SerializedObject\n}\n\n/// A serializer that can handle both data and download responses.\npublic protocol ResponseSerializer: DataResponseSerializerProtocol & DownloadResponseSerializerProtocol {\n    /// `DataPreprocessor` used to prepare incoming `Data` for serialization.\n    var dataPreprocessor: DataPreprocessor { get }\n    /// `HTTPMethod`s for which empty response bodies are considered appropriate.\n    var emptyRequestMethods: Set<HTTPMethod> { get }\n    /// HTTP response codes for which empty response bodies are considered appropriate.\n    var emptyResponseCodes: Set<Int> { get }\n}\n\n/// Type used to preprocess `Data` before it handled by a serializer.\npublic protocol DataPreprocessor {\n    /// Process           `Data` before it's handled by a serializer.\n    /// - Parameter data: The raw `Data` to process.\n    func preprocess(_ data: Data) throws -> Data\n}\n\n/// `DataPreprocessor` that returns passed `Data` without any transform.\npublic struct PassthroughPreprocessor: DataPreprocessor {\n    public init() {}\n\n    public func preprocess(_ data: Data) throws -> Data { return data }\n}\n\n/// `DataPreprocessor` that trims Google's typical `)]}',\\n` XSSI JSON header.\npublic struct GoogleXSSIPreprocessor: DataPreprocessor {\n    public init() {}\n\n    public func preprocess(_ data: Data) throws -> Data {\n        return (data.prefix(6) == Data(\")]}',\\n\".utf8)) ? data.dropFirst(6) : data\n    }\n}\n\nextension ResponseSerializer {\n    /// Default `DataPreprocessor`. `PassthroughPreprocessor` by default.\n    public static var defaultDataPreprocessor: DataPreprocessor { return PassthroughPreprocessor() }\n    /// Default `HTTPMethod`s for which empty response bodies are considered appropriate. `[.head]` by default.\n    public static var defaultEmptyRequestMethods: Set<HTTPMethod> { return [.head] }\n    /// HTTP response codes for which empty response bodies are considered appropriate. `[204, 205]` by default.\n    public static var defaultEmptyResponseCodes: Set<Int> { return [204, 205] }\n\n    public var dataPreprocessor: DataPreprocessor { return Self.defaultDataPreprocessor }\n    public var emptyRequestMethods: Set<HTTPMethod> { return Self.defaultEmptyRequestMethods }\n    public var emptyResponseCodes: Set<Int> { return Self.defaultEmptyResponseCodes }\n\n    /// Determines whether the `request` allows empty response bodies, if `request` exists.\n    ///\n    /// - Parameter request: `URLRequest` to evaluate.\n    ///\n    /// - Returns:           `Bool` representing the outcome of the evaluation, or `nil` if `request` was `nil`.\n    public func requestAllowsEmptyResponseData(_ request: URLRequest?) -> Bool? {\n        return request.flatMap { $0.httpMethod }\n            .flatMap(HTTPMethod.init)\n            .map { emptyRequestMethods.contains($0) }\n    }\n\n    /// Determines whether the `response` allows empty response bodies, if `response` exists`.\n    ///\n    /// - Parameter response: `HTTPURLResponse` to evaluate.\n    ///\n    /// - Returns:            `Bool` representing the outcome of the evaluation, or `nil` if `response` was `nil`.\n    public func responseAllowsEmptyResponseData(_ response: HTTPURLResponse?) -> Bool? {\n        return response.flatMap { $0.statusCode }\n            .map { emptyResponseCodes.contains($0) }\n    }\n\n    /// Determines whether `request` and `response` allow empty response bodies.\n    ///\n    /// - Parameters:\n    ///   - request:  `URLRequest` to evaluate.\n    ///   - response: `HTTPURLResponse` to evaluate.\n    ///\n    /// - Returns:    `true` if `request` or `response` allow empty bodies, `false` otherwise.\n    public func emptyResponseAllowed(forRequest request: URLRequest?, response: HTTPURLResponse?) -> Bool {\n        return (requestAllowsEmptyResponseData(request) == true) || (responseAllowsEmptyResponseData(response) == true)\n    }\n}\n\n/// By default, any serializer declared to conform to both types will get file serialization for free, as it just feeds\n/// the data read from disk into the data response serializer.\npublic extension DownloadResponseSerializerProtocol where Self: DataResponseSerializerProtocol {\n    func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> Self.SerializedObject {\n        guard error == nil else { throw error! }\n\n        guard let fileURL = fileURL else {\n            throw AFError.responseSerializationFailed(reason: .inputFileNil)\n        }\n\n        let data: Data\n        do {\n            data = try Data(contentsOf: fileURL)\n        } catch {\n            throw AFError.responseSerializationFailed(reason: .inputFileReadFailed(at: fileURL))\n        }\n\n        do {\n            return try serialize(request: request, response: response, data: data, error: error)\n        } catch {\n            throw error\n        }\n    }\n}\n\n// MARK: - Default\n\nextension DataRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - completionHandler: The code to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func response(queue: DispatchQueue = .main, completionHandler: @escaping (AFDataResponse<Data?>) -> Void) -> Self {\n        appendResponseSerializer {\n            // Start work that should be on the serialization queue.\n            let result = AFResult<Data?>(value: self.data, error: self.error)\n            // End work that should be on the serialization queue.\n\n            self.underlyingQueue.async {\n                let response = DataResponse(request: self.request,\n                                            response: self.response,\n                                            data: self.data,\n                                            metrics: self.metrics,\n                                            serializationDuration: 0,\n                                            result: result)\n\n                self.eventMonitor?.request(self, didParseResponse: response)\n\n                self.responseSerializerDidComplete { queue.async { completionHandler(response) } }\n            }\n        }\n\n        return self\n    }\n\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:              The queue on which the completion handler is dispatched. `.main` by default\n    ///   - responseSerializer: The response serializer responsible for serializing the request, response, and data.\n    ///   - completionHandler:  The code to be executed once the request has finished.\n    ///\n    /// - Returns:              The request.\n    @discardableResult\n    public func response<Serializer: DataResponseSerializerProtocol>(queue: DispatchQueue = .main,\n                                                                     responseSerializer: Serializer,\n                                                                     completionHandler: @escaping (AFDataResponse<Serializer.SerializedObject>) -> Void)\n        -> Self {\n        appendResponseSerializer {\n            // Start work that should be on the serialization queue.\n            let start = CFAbsoluteTimeGetCurrent()\n            let result: AFResult<Serializer.SerializedObject> = Result {\n                try responseSerializer.serialize(request: self.request,\n                                                 response: self.response,\n                                                 data: self.data,\n                                                 error: self.error)\n            }.mapError { error in\n                error.asAFError(or: .responseSerializationFailed(reason: .customSerializationFailed(error: error)))\n            }\n\n            let end = CFAbsoluteTimeGetCurrent()\n            // End work that should be on the serialization queue.\n\n            self.underlyingQueue.async {\n                let response = DataResponse(request: self.request,\n                                            response: self.response,\n                                            data: self.data,\n                                            metrics: self.metrics,\n                                            serializationDuration: end - start,\n                                            result: result)\n\n                self.eventMonitor?.request(self, didParseResponse: response)\n\n                guard let serializerError = result.failure, let delegate = self.delegate else {\n                    self.responseSerializerDidComplete { queue.async { completionHandler(response) } }\n                    return\n                }\n\n                delegate.retryResult(for: self, dueTo: serializerError) { retryResult in\n                    var didComplete: (() -> Void)?\n\n                    defer {\n                        if let didComplete = didComplete {\n                            self.responseSerializerDidComplete { queue.async { didComplete() } }\n                        }\n                    }\n\n                    switch retryResult {\n                    case .doNotRetry:\n                        didComplete = { completionHandler(response) }\n\n                    case let .doNotRetryWithError(retryError):\n                        let result: AFResult<Serializer.SerializedObject> = .failure(retryError.asAFError(orFailWith: \"Received retryError was not already AFError\"))\n\n                        let response = DataResponse(request: self.request,\n                                                    response: self.response,\n                                                    data: self.data,\n                                                    metrics: self.metrics,\n                                                    serializationDuration: end - start,\n                                                    result: result)\n\n                        didComplete = { completionHandler(response) }\n\n                    case .retry, .retryWithDelay:\n                        delegate.retryRequest(self, withDelay: retryResult.delay)\n                    }\n                }\n            }\n        }\n\n        return self\n    }\n}\n\nextension DownloadRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - completionHandler: The code to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func response(queue: DispatchQueue = .main,\n                         completionHandler: @escaping (AFDownloadResponse<URL?>) -> Void)\n        -> Self {\n        appendResponseSerializer {\n            // Start work that should be on the serialization queue.\n            let result = AFResult<URL?>(value: self.fileURL, error: self.error)\n            // End work that should be on the serialization queue.\n\n            self.underlyingQueue.async {\n                let response = DownloadResponse(request: self.request,\n                                                response: self.response,\n                                                fileURL: self.fileURL,\n                                                resumeData: self.resumeData,\n                                                metrics: self.metrics,\n                                                serializationDuration: 0,\n                                                result: result)\n\n                self.eventMonitor?.request(self, didParseResponse: response)\n\n                self.responseSerializerDidComplete { queue.async { completionHandler(response) } }\n            }\n        }\n\n        return self\n    }\n\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:              The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - responseSerializer: The response serializer responsible for serializing the request, response, and data\n    ///                         contained in the destination `URL`.\n    ///   - completionHandler:  The code to be executed once the request has finished.\n    ///\n    /// - Returns:              The request.\n    @discardableResult\n    public func response<Serializer: DownloadResponseSerializerProtocol>(queue: DispatchQueue = .main,\n                                                                         responseSerializer: Serializer,\n                                                                         completionHandler: @escaping (AFDownloadResponse<Serializer.SerializedObject>) -> Void)\n        -> Self {\n        appendResponseSerializer {\n            // Start work that should be on the serialization queue.\n            let start = CFAbsoluteTimeGetCurrent()\n            let result: AFResult<Serializer.SerializedObject> = Result {\n                try responseSerializer.serializeDownload(request: self.request,\n                                                         response: self.response,\n                                                         fileURL: self.fileURL,\n                                                         error: self.error)\n            }.mapError { error in\n                error.asAFError(or: .responseSerializationFailed(reason: .customSerializationFailed(error: error)))\n            }\n            let end = CFAbsoluteTimeGetCurrent()\n            // End work that should be on the serialization queue.\n\n            self.underlyingQueue.async {\n                let response = DownloadResponse(request: self.request,\n                                                response: self.response,\n                                                fileURL: self.fileURL,\n                                                resumeData: self.resumeData,\n                                                metrics: self.metrics,\n                                                serializationDuration: end - start,\n                                                result: result)\n\n                self.eventMonitor?.request(self, didParseResponse: response)\n\n                guard let serializerError = result.failure, let delegate = self.delegate else {\n                    self.responseSerializerDidComplete { queue.async { completionHandler(response) } }\n                    return\n                }\n\n                delegate.retryResult(for: self, dueTo: serializerError) { retryResult in\n                    var didComplete: (() -> Void)?\n\n                    defer {\n                        if let didComplete = didComplete {\n                            self.responseSerializerDidComplete { queue.async { didComplete() } }\n                        }\n                    }\n\n                    switch retryResult {\n                    case .doNotRetry:\n                        didComplete = { completionHandler(response) }\n\n                    case let .doNotRetryWithError(retryError):\n                        let result: AFResult<Serializer.SerializedObject> = .failure(retryError.asAFError(orFailWith: \"Received retryError was not already AFError\"))\n\n                        let response = DownloadResponse(request: self.request,\n                                                        response: self.response,\n                                                        fileURL: self.fileURL,\n                                                        resumeData: self.resumeData,\n                                                        metrics: self.metrics,\n                                                        serializationDuration: end - start,\n                                                        result: result)\n\n                        didComplete = { completionHandler(response) }\n\n                    case .retry, .retryWithDelay:\n                        delegate.retryRequest(self, withDelay: retryResult.delay)\n                    }\n                }\n            }\n        }\n\n        return self\n    }\n}\n\n// MARK: - Data\n\nextension DataRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - completionHandler: The code to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func responseData(queue: DispatchQueue = .main,\n                             completionHandler: @escaping (AFDataResponse<Data>) -> Void)\n        -> Self {\n        return response(queue: queue,\n                        responseSerializer: DataResponseSerializer(),\n                        completionHandler: completionHandler)\n    }\n}\n\n/// A `ResponseSerializer` that performs minimal response checking and returns any response data as-is. By default, a\n/// request returning `nil` or no data is considered an error. However, if the response is has a status code valid for\n/// empty responses (`204`, `205`), then an empty `Data` value is returned.\npublic final class DataResponseSerializer: ResponseSerializer {\n    public let dataPreprocessor: DataPreprocessor\n    public let emptyResponseCodes: Set<Int>\n    public let emptyRequestMethods: Set<HTTPMethod>\n\n    /// Creates an instance using the provided values.\n    ///\n    /// - Parameters:\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    public init(dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,\n                emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,\n                emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) {\n        self.dataPreprocessor = dataPreprocessor\n        self.emptyResponseCodes = emptyResponseCodes\n        self.emptyRequestMethods = emptyRequestMethods\n    }\n\n    public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> Data {\n        guard error == nil else { throw error! }\n\n        guard var data = data, !data.isEmpty else {\n            guard emptyResponseAllowed(forRequest: request, response: response) else {\n                throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)\n            }\n\n            return Data()\n        }\n\n        data = try dataPreprocessor.preprocess(data)\n\n        return data\n    }\n}\n\nextension DownloadRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - completionHandler: The code to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func responseData(queue: DispatchQueue = .main,\n                             completionHandler: @escaping (AFDownloadResponse<Data>) -> Void)\n        -> Self {\n        return response(queue: queue,\n                        responseSerializer: DataResponseSerializer(),\n                        completionHandler: completionHandler)\n    }\n}\n\n// MARK: - String\n\n/// A `ResponseSerializer` that decodes the response data as a `String`. By default, a request returning `nil` or no\n/// data is considered an error. However, if the response is has a status code valid for empty responses (`204`, `205`),\n/// then an empty `String` is returned.\npublic final class StringResponseSerializer: ResponseSerializer {\n    public let dataPreprocessor: DataPreprocessor\n    /// Optional string encoding used to validate the response.\n    public let encoding: String.Encoding?\n    public let emptyResponseCodes: Set<Int>\n    public let emptyRequestMethods: Set<HTTPMethod>\n\n    /// Creates an instance with the provided values.\n    ///\n    /// - Parameters:\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - encoding:            A string encoding. Defaults to `nil`, in which case the encoding will be determined\n    ///                          from the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    public init(dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,\n                encoding: String.Encoding? = nil,\n                emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,\n                emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) {\n        self.dataPreprocessor = dataPreprocessor\n        self.encoding = encoding\n        self.emptyResponseCodes = emptyResponseCodes\n        self.emptyRequestMethods = emptyRequestMethods\n    }\n\n    public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> String {\n        guard error == nil else { throw error! }\n\n        guard var data = data, !data.isEmpty else {\n            guard emptyResponseAllowed(forRequest: request, response: response) else {\n                throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)\n            }\n\n            return \"\"\n        }\n\n        data = try dataPreprocessor.preprocess(data)\n\n        var convertedEncoding = encoding\n\n        if let encodingName = response?.textEncodingName as CFString?, convertedEncoding == nil {\n            let ianaCharSet = CFStringConvertIANACharSetNameToEncoding(encodingName)\n            let nsStringEncoding = CFStringConvertEncodingToNSStringEncoding(ianaCharSet)\n            convertedEncoding = String.Encoding(rawValue: nsStringEncoding)\n        }\n\n        let actualEncoding = convertedEncoding ?? .isoLatin1\n\n        guard let string = String(data: data, encoding: actualEncoding) else {\n            throw AFError.responseSerializationFailed(reason: .stringSerializationFailed(encoding: actualEncoding))\n        }\n\n        return string\n    }\n}\n\nextension DataRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - encoding:          The string encoding. Defaults to `nil`, in which case the encoding will be determined from\n    ///                        the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - completionHandler: A closure to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func responseString(queue: DispatchQueue = .main,\n                               encoding: String.Encoding? = nil,\n                               completionHandler: @escaping (AFDataResponse<String>) -> Void) -> Self {\n        return response(queue: queue,\n                        responseSerializer: StringResponseSerializer(encoding: encoding),\n                        completionHandler: completionHandler)\n    }\n}\n\nextension DownloadRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - encoding:          The string encoding. Defaults to `nil`, in which case the encoding will be determined from\n    ///                        the server response, falling back to the default HTTP character set, `ISO-8859-1`.\n    ///   - completionHandler: A closure to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func responseString(queue: DispatchQueue = .main,\n                               encoding: String.Encoding? = nil,\n                               completionHandler: @escaping (AFDownloadResponse<String>) -> Void)\n        -> Self {\n        return response(queue: queue,\n                        responseSerializer: StringResponseSerializer(encoding: encoding),\n                        completionHandler: completionHandler)\n    }\n}\n\n// MARK: - JSON\n\n/// A `ResponseSerializer` that decodes the response data using `JSONSerialization`. By default, a request returning\n/// `nil` or no data is considered an error. However, if the response is has a status code valid for empty responses\n/// (`204`, `205`), then an `NSNull`  value is returned.\npublic final class JSONResponseSerializer: ResponseSerializer {\n    public let dataPreprocessor: DataPreprocessor\n    public let emptyResponseCodes: Set<Int>\n    public let emptyRequestMethods: Set<HTTPMethod>\n    /// `JSONSerialization.ReadingOptions` used when serializing a response.\n    public let options: JSONSerialization.ReadingOptions\n\n    /// Creates an instance with the provided values.\n    ///\n    /// - Parameters:\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    ///   - options:             The options to use. `.allowFragments` by default.\n    public init(dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor,\n                emptyResponseCodes: Set<Int> = JSONResponseSerializer.defaultEmptyResponseCodes,\n                emptyRequestMethods: Set<HTTPMethod> = JSONResponseSerializer.defaultEmptyRequestMethods,\n                options: JSONSerialization.ReadingOptions = .allowFragments) {\n        self.dataPreprocessor = dataPreprocessor\n        self.emptyResponseCodes = emptyResponseCodes\n        self.emptyRequestMethods = emptyRequestMethods\n        self.options = options\n    }\n\n    public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> Any {\n        guard error == nil else { throw error! }\n\n        guard var data = data, !data.isEmpty else {\n            guard emptyResponseAllowed(forRequest: request, response: response) else {\n                throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)\n            }\n\n            return NSNull()\n        }\n\n        data = try dataPreprocessor.preprocess(data)\n\n        do {\n            return try JSONSerialization.jsonObject(with: data, options: options)\n        } catch {\n            throw AFError.responseSerializationFailed(reason: .jsonSerializationFailed(error: error))\n        }\n    }\n}\n\nextension DataRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - options:           The JSON serialization reading options. `.allowFragments` by default.\n    ///   - completionHandler: A closure to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func responseJSON(queue: DispatchQueue = .main,\n                             options: JSONSerialization.ReadingOptions = .allowFragments,\n                             completionHandler: @escaping (AFDataResponse<Any>) -> Void) -> Self {\n        return response(queue: queue,\n                        responseSerializer: JSONResponseSerializer(options: options),\n                        completionHandler: completionHandler)\n    }\n}\n\nextension DownloadRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - options:           The JSON serialization reading options. `.allowFragments` by default.\n    ///   - completionHandler: A closure to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func responseJSON(queue: DispatchQueue = .main,\n                             options: JSONSerialization.ReadingOptions = .allowFragments,\n                             completionHandler: @escaping (AFDownloadResponse<Any>) -> Void)\n        -> Self {\n        return response(queue: queue,\n                        responseSerializer: JSONResponseSerializer(options: options),\n                        completionHandler: completionHandler)\n    }\n}\n\n// MARK: - Empty\n\n/// Protocol representing an empty response. Use `T.emptyValue()` to get an instance.\npublic protocol EmptyResponse {\n    /// Empty value for the conforming type.\n    ///\n    /// - Returns: Value of `Self` to use for empty values.\n    static func emptyValue() -> Self\n}\n\n/// Type representing an empty response. Use `Empty.value` to get the static instance.\npublic struct Empty: Decodable {\n    /// Static `Empty` instance used for all `Empty` responses.\n    public static let value = Empty()\n}\n\nextension Empty: EmptyResponse {\n    public static func emptyValue() -> Empty {\n        return value\n    }\n}\n\n// MARK: - DataDecoder Protocol\n\n/// Any type which can decode `Data` into a `Decodable` type.\npublic protocol DataDecoder {\n    /// Decode `Data` into the provided type.\n    ///\n    /// - Parameters:\n    ///   - type:  The `Type` to be decoded.\n    ///   - data:  The `Data` to be decoded.\n    ///\n    /// - Returns: The decoded value of type `D`.\n    /// - Throws:  Any error that occurs during decode.\n    func decode<D: Decodable>(_ type: D.Type, from data: Data) throws -> D\n}\n\n/// `JSONDecoder` automatically conforms to `DataDecoder`.\nextension JSONDecoder: DataDecoder {}\n\n// MARK: - Decodable\n\n/// A `ResponseSerializer` that decodes the response data as a generic value using any type that conforms to\n/// `DataDecoder`. By default, this is an instance of `JSONDecoder`. Additionally, a request returning `nil` or no data\n/// is considered an error. However, if the response is has a status code valid for empty responses (`204`, `205`), then\n/// the `Empty.value` value is returned.\npublic final class DecodableResponseSerializer<T: Decodable>: ResponseSerializer {\n    public let dataPreprocessor: DataPreprocessor\n    /// The `DataDecoder` instance used to decode responses.\n    public let decoder: DataDecoder\n    public let emptyResponseCodes: Set<Int>\n    public let emptyRequestMethods: Set<HTTPMethod>\n\n    /// Creates an instance using the values provided.\n    ///\n    /// - Parameters:\n    ///   - dataPreprocessor:    `DataPreprocessor` used to prepare the received `Data` for serialization.\n    ///   - decoder:             The `DataDecoder`. `JSONDecoder()` by default.\n    ///   - emptyResponseCodes:  The HTTP response codes for which empty responses are allowed. `[204, 205]` by default.\n    ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.\n    public init(dataPreprocessor: DataPreprocessor = DecodableResponseSerializer.defaultDataPreprocessor,\n                decoder: DataDecoder = JSONDecoder(),\n                emptyResponseCodes: Set<Int> = DecodableResponseSerializer.defaultEmptyResponseCodes,\n                emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer.defaultEmptyRequestMethods) {\n        self.dataPreprocessor = dataPreprocessor\n        self.decoder = decoder\n        self.emptyResponseCodes = emptyResponseCodes\n        self.emptyRequestMethods = emptyRequestMethods\n    }\n\n    public func serialize(request: URLRequest?, response: HTTPURLResponse?, data: Data?, error: Error?) throws -> T {\n        guard error == nil else { throw error! }\n\n        guard var data = data, !data.isEmpty else {\n            guard emptyResponseAllowed(forRequest: request, response: response) else {\n                throw AFError.responseSerializationFailed(reason: .inputDataNilOrZeroLength)\n            }\n\n            guard let emptyResponseType = T.self as? EmptyResponse.Type, let emptyValue = emptyResponseType.emptyValue() as? T else {\n                throw AFError.responseSerializationFailed(reason: .invalidEmptyResponse(type: \"\\(T.self)\"))\n            }\n\n            return emptyValue\n        }\n\n        data = try dataPreprocessor.preprocess(data)\n\n        do {\n            return try decoder.decode(T.self, from: data)\n        } catch {\n            throw AFError.responseSerializationFailed(reason: .decodingFailed(error: error))\n        }\n    }\n}\n\nextension DataRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - type:              `Decodable` type to decode from response data.\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - decoder:           `DataDecoder` to use to decode the response. `JSONDecoder()` by default.\n    ///   - completionHandler: A closure to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func responseDecodable<T: Decodable>(of type: T.Type = T.self,\n                                                queue: DispatchQueue = .main,\n                                                decoder: DataDecoder = JSONDecoder(),\n                                                completionHandler: @escaping (AFDataResponse<T>) -> Void) -> Self {\n        return response(queue: queue,\n                        responseSerializer: DecodableResponseSerializer(decoder: decoder),\n                        completionHandler: completionHandler)\n    }\n}\n\nextension DownloadRequest {\n    /// Adds a handler to be called once the request has finished.\n    ///\n    /// - Parameters:\n    ///   - type:              `Decodable` type to decode from response data.\n    ///   - queue:             The queue on which the completion handler is dispatched. `.main` by default.\n    ///   - decoder:           `DataDecoder` to use to decode the response. `JSONDecoder()` by default.\n    ///   - completionHandler: A closure to be executed once the request has finished.\n    ///\n    /// - Returns:             The request.\n    @discardableResult\n    public func responseDecodable<T: Decodable>(of type: T.Type = T.self,\n                                                queue: DispatchQueue = .main,\n                                                decoder: DataDecoder = JSONDecoder(),\n                                                completionHandler: @escaping (AFDownloadResponse<T>) -> Void) -> Self {\n        return response(queue: queue,\n                        responseSerializer: DecodableResponseSerializer(decoder: decoder),\n                        completionHandler: completionHandler)\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/Result+Alamofire.swift",
    "content": "//\n//  Result+Alamofire.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Default type of `Result` returned by Alamofire, with an `AFError` `Failure` type.\npublic typealias AFResult<Success> = Result<Success, AFError>\n\n// MARK: - Internal APIs\n\nextension Result {\n    /// Returns the associated value if the result is a success, `nil` otherwise.\n    var success: Success? {\n        guard case let .success(value) = self else { return nil }\n        return value\n    }\n\n    /// Returns the associated error value if the result is a failure, `nil` otherwise.\n    var failure: Failure? {\n        guard case let .failure(error) = self else { return nil }\n        return error\n    }\n\n    /// Initializes a `Result` from value or error. Returns `.failure` if the error is non-nil, `.success` otherwise.\n    ///\n    /// - Parameters:\n    ///   - value: A value.\n    ///   - error: An `Error`.\n    init(value: Success, error: Failure?) {\n        if let error = error {\n            self = .failure(error)\n        } else {\n            self = .success(value)\n        }\n    }\n\n    /// Evaluates the specified closure when the `Result` is a success, passing the unwrapped value as a parameter.\n    ///\n    /// Use the `tryMap` method with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: Result<Data, Error> = .success(Data(...))\n    ///     let possibleObject = possibleData.tryMap {\n    ///         try JSONSerialization.jsonObject(with: $0)\n    ///     }\n    ///\n    /// - parameter transform: A closure that takes the success value of the instance.\n    ///\n    /// - returns: A `Result` containing the result of the given closure. If this instance is a failure, returns the\n    ///            same failure.\n    func tryMap<NewSuccess>(_ transform: (Success) throws -> NewSuccess) -> Result<NewSuccess, Error> {\n        switch self {\n        case let .success(value):\n            do {\n                return try .success(transform(value))\n            } catch {\n                return .failure(error)\n            }\n        case let .failure(error):\n            return .failure(error)\n        }\n    }\n\n    /// Evaluates the specified closure when the `Result` is a failure, passing the unwrapped error as a parameter.\n    ///\n    /// Use the `tryMapError` function with a closure that may throw an error. For example:\n    ///\n    ///     let possibleData: Result<Data, Error> = .success(Data(...))\n    ///     let possibleObject = possibleData.tryMapError {\n    ///         try someFailableFunction(taking: $0)\n    ///     }\n    ///\n    /// - Parameter transform: A throwing closure that takes the error of the instance.\n    ///\n    /// - Returns: A `Result` instance containing the result of the transform. If this instance is a success, returns\n    ///            the same success.\n    func tryMapError<NewFailure: Error>(_ transform: (Failure) throws -> NewFailure) -> Result<Success, Error> {\n        switch self {\n        case let .failure(error):\n            do {\n                return try .failure(transform(error))\n            } catch {\n                return .failure(error)\n            }\n        case let .success(value):\n            return .success(value)\n        }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/RetryPolicy.swift",
    "content": "//\n//  RetryPolicy.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// A retry policy that retries requests using an exponential backoff for allowed HTTP methods and HTTP status codes\n/// as well as certain types of networking errors.\nopen class RetryPolicy: RequestInterceptor {\n    /// The default retry limit for retry policies.\n    public static let defaultRetryLimit: UInt = 2\n\n    /// The default exponential backoff base for retry policies (must be a minimum of 2).\n    public static let defaultExponentialBackoffBase: UInt = 2\n\n    /// The default exponential backoff scale for retry policies.\n    public static let defaultExponentialBackoffScale: Double = 0.5\n\n    /// The default HTTP methods to retry.\n    /// See [RFC 2616 - Section 9.1.2](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html) for more information.\n    public static let defaultRetryableHTTPMethods: Set<HTTPMethod> = [.delete, // [Delete](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.7) - not always idempotent\n                                                                      .get, // [GET](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3) - generally idempotent\n                                                                      .head, // [HEAD](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4) - generally idempotent\n                                                                      .options, // [OPTIONS](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2) - inherently idempotent\n                                                                      .put, // [PUT](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6) - not always idempotent\n                                                                      .trace // [TRACE](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.8) - inherently idempotent\n    ]\n\n    /// The default HTTP status codes to retry.\n    /// See [RFC 2616 - Section 10](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10) for more information.\n    public static let defaultRetryableHTTPStatusCodes: Set<Int> = [408, // [Request Timeout](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.9)\n                                                                   500, // [Internal Server Error](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1)\n                                                                   502, // [Bad Gateway](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.3)\n                                                                   503, // [Service Unavailable](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4)\n                                                                   504 // [Gateway Timeout](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.5)\n    ]\n\n    /// The default URL error codes to retry.\n    public static let defaultRetryableURLErrorCodes: Set<URLError.Code> = [// [Security] App Transport Security disallowed a connection because there is no secure network connection.\n        //   - [Disabled] ATS settings do not change at runtime.\n        // .appTransportSecurityRequiresSecureConnection,\n\n        // [System] An app or app extension attempted to connect to a background session that is already connected to a\n        // process.\n        //   - [Enabled] The other process could release the background session.\n        .backgroundSessionInUseByAnotherProcess,\n                                                                           \n        // [System] The shared container identifier of the URL session configuration is needed but has not been set.\n        //   - [Disabled] Cannot change at runtime.\n        // .backgroundSessionRequiresSharedContainer,\n\n        // [System] The app is suspended or exits while a background data task is processing.\n        //   - [Enabled] App can be foregrounded or launched to recover.\n        .backgroundSessionWasDisconnected,\n                                                                           \n        // [Network] The URL Loading system received bad data from the server.\n        //   - [Enabled] Server could return valid data when retrying.\n        .badServerResponse,\n                                                                           \n        // [Resource] A malformed URL prevented a URL request from being initiated.\n        //   - [Disabled] URL was most likely constructed incorrectly.\n        // .badURL,\n\n        // [System] A connection was attempted while a phone call is active on a network that does not support\n        // simultaneous phone and data communication (EDGE or GPRS).\n        //   - [Enabled] Phone call could be ended to allow request to recover.\n        .callIsActive,\n                                                                           \n        // [Client] An asynchronous load has been canceled.\n        //   - [Disabled] Request was cancelled by the client.\n        // .cancelled,\n\n        // [File System] A download task couldn’t close the downloaded file on disk.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotCloseFile,\n\n        // [Network] An attempt to connect to a host failed.\n        //   - [Enabled] Server or DNS lookup could recover during retry.\n        .cannotConnectToHost,\n                                                                           \n        // [File System] A download task couldn’t create the downloaded file on disk because of an I/O failure.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotCreateFile,\n\n        // [Data] Content data received during a connection request had an unknown content encoding.\n        //   - [Disabled] Server is unlikely to modify the content encoding during a retry.\n        // .cannotDecodeContentData,\n\n        // [Data] Content data received during a connection request could not be decoded for a known content encoding.\n        //   - [Disabled] Server is unlikely to modify the content encoding during a retry.\n        // .cannotDecodeRawData,\n\n        // [Network] The host name for a URL could not be resolved.\n        //   - [Enabled] Server or DNS lookup could recover during retry.\n        .cannotFindHost,\n                                                                           \n        // [Network] A request to load an item only from the cache could not be satisfied.\n        //   - [Enabled] Cache could be populated during a retry.\n        .cannotLoadFromNetwork,\n                                                                           \n        // [File System] A download task was unable to move a downloaded file on disk.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotMoveFile,\n\n        // [File System] A download task was unable to open the downloaded file on disk.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotOpenFile,\n\n        // [Data] A task could not parse a response.\n        //   - [Disabled] Invalid response is unlikely to recover with retry.\n        // .cannotParseResponse,\n\n        // [File System] A download task was unable to remove a downloaded file from disk.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotRemoveFile,\n\n        // [File System] A download task was unable to write to the downloaded file on disk.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .cannotWriteToFile,\n\n        // [Security] A client certificate was rejected.\n        //   - [Disabled] Client certificate is unlikely to change with retry.\n        // .clientCertificateRejected,\n\n        // [Security] A client certificate was required to authenticate an SSL connection during a request.\n        //   - [Disabled] Client certificate is unlikely to be provided with retry.\n        // .clientCertificateRequired,\n\n        // [Data] The length of the resource data exceeds the maximum allowed.\n        //   - [Disabled] Resource will likely still exceed the length maximum on retry.\n        // .dataLengthExceedsMaximum,\n\n        // [System] The cellular network disallowed a connection.\n        //   - [Enabled] WiFi connection could be established during retry.\n        .dataNotAllowed,\n                                                                           \n        // [Network] The host address could not be found via DNS lookup.\n        //   - [Enabled] DNS lookup could succeed during retry.\n        .dnsLookupFailed,\n                                                                           \n        // [Data] A download task failed to decode an encoded file during the download.\n        //   - [Enabled] Server could correct the decoding issue with retry.\n        .downloadDecodingFailedMidStream,\n                                                                           \n        // [Data] A download task failed to decode an encoded file after downloading.\n        //   - [Enabled] Server could correct the decoding issue with retry.\n        .downloadDecodingFailedToComplete,\n                                                                           \n        // [File System] A file does not exist.\n        //   - [Disabled] File system error is unlikely to recover with retry.\n        // .fileDoesNotExist,\n\n        // [File System] A request for an FTP file resulted in the server responding that the file is not a plain file,\n        // but a directory.\n        //   - [Disabled] FTP directory is not likely to change to a file during a retry.\n        // .fileIsDirectory,\n\n        // [Network] A redirect loop has been detected or the threshold for number of allowable redirects has been\n        // exceeded (currently 16).\n        //   - [Disabled] The redirect loop is unlikely to be resolved within the retry window.\n        // .httpTooManyRedirects,\n\n        // [System] The attempted connection required activating a data context while roaming, but international roaming\n        // is disabled.\n        //   - [Enabled] WiFi connection could be established during retry.\n        .internationalRoamingOff,\n                                                                           \n        // [Connectivity] A client or server connection was severed in the middle of an in-progress load.\n        //   - [Enabled] A network connection could be established during retry.\n        .networkConnectionLost,\n                                                                           \n        // [File System] A resource couldn’t be read because of insufficient permissions.\n        //   - [Disabled] Permissions are unlikely to be granted during retry.\n        // .noPermissionsToReadFile,\n\n        // [Connectivity] A network resource was requested, but an internet connection has not been established and\n        // cannot be established automatically.\n        //   - [Enabled] A network connection could be established during retry.\n        .notConnectedToInternet,\n                                                                           \n        // [Resource] A redirect was specified by way of server response code, but the server did not accompany this\n        // code with a redirect URL.\n        //   - [Disabled] The redirect URL is unlikely to be supplied during a retry.\n        // .redirectToNonExistentLocation,\n\n        // [Client] A body stream is needed but the client did not provide one.\n        //   - [Disabled] The client will be unlikely to supply a body stream during retry.\n        // .requestBodyStreamExhausted,\n\n        // [Resource] A requested resource couldn’t be retrieved.\n        //   - [Disabled] The resource is unlikely to become available during the retry window.\n        // .resourceUnavailable,\n\n        // [Security] An attempt to establish a secure connection failed for reasons that can’t be expressed more\n        // specifically.\n        //   - [Enabled] The secure connection could be established during a retry given the lack of specificity\n        //     provided by the error.\n        .secureConnectionFailed,\n                                                                           \n        // [Security] A server certificate had a date which indicates it has expired, or is not yet valid.\n        //   - [Enabled] The server certificate could become valid within the retry window.\n        .serverCertificateHasBadDate,\n                                                                           \n        // [Security] A server certificate was not signed by any root server.\n        //   - [Disabled] The server certificate is unlikely to change during the retry window.\n        // .serverCertificateHasUnknownRoot,\n\n        // [Security] A server certificate is not yet valid.\n        //   - [Enabled] The server certificate could become valid within the retry window.\n        .serverCertificateNotYetValid,\n                                                                           \n        // [Security] A server certificate was signed by a root server that isn’t trusted.\n        //   - [Disabled] The server certificate is unlikely to become trusted within the retry window.\n        // .serverCertificateUntrusted,\n\n        // [Network] An asynchronous operation timed out.\n        //   - [Enabled] The request timed out for an unknown reason and should be retried.\n        .timedOut\n\n        // [System] The URL Loading System encountered an error that it can’t interpret.\n        //   - [Disabled] The error could not be interpreted and is unlikely to be recovered from during a retry.\n        // .unknown,\n\n        // [Resource] A properly formed URL couldn’t be handled by the framework.\n        //   - [Disabled] The URL is unlikely to change during a retry.\n        // .unsupportedURL,\n\n        // [Client] Authentication is required to access a resource.\n        //   - [Disabled] The user authentication is unlikely to be provided by retrying.\n        // .userAuthenticationRequired,\n\n        // [Client] An asynchronous request for authentication has been canceled by the user.\n        //   - [Disabled] The user cancelled authentication and explicitly took action to not retry.\n        // .userCancelledAuthentication,\n\n        // [Resource] A server reported that a URL has a non-zero content length, but terminated the network connection\n        // gracefully without sending any data.\n        //   - [Disabled] The server is unlikely to provide data during the retry window.\n        // .zeroByteResource,\n    ]\n\n    /// The total number of times the request is allowed to be retried.\n    public let retryLimit: UInt\n\n    /// The base of the exponential backoff policy (should always be greater than or equal to 2).\n    public let exponentialBackoffBase: UInt\n\n    /// The scale of the exponential backoff.\n    public let exponentialBackoffScale: Double\n\n    /// The HTTP methods that are allowed to be retried.\n    public let retryableHTTPMethods: Set<HTTPMethod>\n\n    /// The HTTP status codes that are automatically retried by the policy.\n    public let retryableHTTPStatusCodes: Set<Int>\n\n    /// The URL error codes that are automatically retried by the policy.\n    public let retryableURLErrorCodes: Set<URLError.Code>\n\n    /// Creates an `ExponentialBackoffRetryPolicy` from the specified parameters.\n    ///\n    /// - Parameters:\n    ///   - retryLimit:               The total number of times the request is allowed to be retried. `2` by default.\n    ///   - exponentialBackoffBase:   The base of the exponential backoff policy. `2` by default.\n    ///   - exponentialBackoffScale:  The scale of the exponential backoff. `0.5` by default.\n    ///   - retryableHTTPMethods:     The HTTP methods that are allowed to be retried.\n    ///                               `RetryPolicy.defaultRetryableHTTPMethods` by default.\n    ///   - retryableHTTPStatusCodes: The HTTP status codes that are automatically retried by the policy.\n    ///                               `RetryPolicy.defaultRetryableHTTPStatusCodes` by default.\n    ///   - retryableURLErrorCodes:   The URL error codes that are automatically retried by the policy.\n    ///                               `RetryPolicy.defaultRetryableURLErrorCodes` by default.\n    public init(retryLimit: UInt = RetryPolicy.defaultRetryLimit,\n                exponentialBackoffBase: UInt = RetryPolicy.defaultExponentialBackoffBase,\n                exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale,\n                retryableHTTPMethods: Set<HTTPMethod> = RetryPolicy.defaultRetryableHTTPMethods,\n                retryableHTTPStatusCodes: Set<Int> = RetryPolicy.defaultRetryableHTTPStatusCodes,\n                retryableURLErrorCodes: Set<URLError.Code> = RetryPolicy.defaultRetryableURLErrorCodes) {\n        precondition(exponentialBackoffBase >= 2, \"The `exponentialBackoffBase` must be a minimum of 2.\")\n\n        self.retryLimit = retryLimit\n        self.exponentialBackoffBase = exponentialBackoffBase\n        self.exponentialBackoffScale = exponentialBackoffScale\n        self.retryableHTTPMethods = retryableHTTPMethods\n        self.retryableHTTPStatusCodes = retryableHTTPStatusCodes\n        self.retryableURLErrorCodes = retryableURLErrorCodes\n    }\n\n    open func retry(_ request: Request,\n                    for session: Session,\n                    dueTo error: Error,\n                    completion: @escaping (RetryResult) -> Void) {\n        if\n            request.retryCount < retryLimit,\n            let httpMethod = request.request?.method,\n            retryableHTTPMethods.contains(httpMethod),\n            shouldRetry(response: request.response, error: error) {\n            let timeDelay = pow(Double(exponentialBackoffBase), Double(request.retryCount)) * exponentialBackoffScale\n            completion(.retryWithDelay(timeDelay))\n        } else {\n            completion(.doNotRetry)\n        }\n    }\n\n    private func shouldRetry(response: HTTPURLResponse?, error: Error) -> Bool {\n        if let statusCode = response?.statusCode, retryableHTTPStatusCodes.contains(statusCode) {\n            return true\n        } else if let errorCode = (error as? URLError)?.code, retryableURLErrorCodes.contains(errorCode) {\n            return true\n        }\n\n        return false\n    }\n}\n\n// MARK: -\n\n/// A retry policy that automatically retries idempotent requests for network connection lost errors. For more\n/// information about retrying network connection lost errors, please refer to Apple's\n/// [technical document](https://developer.apple.com/library/content/qa/qa1941/_index.html).\nopen class ConnectionLostRetryPolicy: RetryPolicy {\n    /// Creates a `ConnectionLostRetryPolicy` instance from the specified parameters.\n    ///\n    /// - Parameters:\n    ///   - retryLimit:              The total number of times the request is allowed to be retried.\n    ///                              `RetryPolicy.defaultRetryLimit` by default.\n    ///   - exponentialBackoffBase:  The base of the exponential backoff policy.\n    ///                              `RetryPolicy.defaultExponentialBackoffBase` by default.\n    ///   - exponentialBackoffScale: The scale of the exponential backoff.\n    ///                              `RetryPolicy.defaultExponentialBackoffScale` by default.\n    ///   - retryableHTTPMethods:    The idempotent http methods to retry.\n    ///                              `RetryPolicy.defaultRetryableHTTPMethods` by default.\n    public init(retryLimit: UInt = RetryPolicy.defaultRetryLimit,\n                exponentialBackoffBase: UInt = RetryPolicy.defaultExponentialBackoffBase,\n                exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale,\n                retryableHTTPMethods: Set<HTTPMethod> = RetryPolicy.defaultRetryableHTTPMethods) {\n        super.init(retryLimit: retryLimit,\n                   exponentialBackoffBase: exponentialBackoffBase,\n                   exponentialBackoffScale: exponentialBackoffScale,\n                   retryableHTTPMethods: retryableHTTPMethods,\n                   retryableHTTPStatusCodes: [],\n                   retryableURLErrorCodes: [.networkConnectionLost])\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/ServerTrustEvaluation.swift",
    "content": "//\n//  ServerTrustPolicy.swift\n//\n//  Copyright (c) 2014-2016 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Responsible for managing the mapping of `ServerTrustEvaluating` values to given hosts.\nopen class ServerTrustManager {\n    /// Determines whether all hosts for this `ServerTrustManager` must be evaluated. `true` by default.\n    public let allHostsMustBeEvaluated: Bool\n\n    /// The dictionary of policies mapped to a particular host.\n    public let evaluators: [String: ServerTrustEvaluating]\n\n    /// Initializes the `ServerTrustManager` instance with the given evaluators.\n    ///\n    /// Since different servers and web services can have different leaf certificates, intermediate and even root\n    /// certificates, it is important to have the flexibility to specify evaluation policies on a per host basis. This\n    /// allows for scenarios such as using default evaluation for host1, certificate pinning for host2, public key\n    /// pinning for host3 and disabling evaluation for host4.\n    ///\n    /// - Parameters:\n    ///   - allHostsMustBeEvaluated: The value determining whether all hosts for this instance must be evaluated. `true`\n    ///                              by default.\n    ///   - evaluators:              A dictionary of evaluators mapped to hosts.\n    public init(allHostsMustBeEvaluated: Bool = true, evaluators: [String: ServerTrustEvaluating]) {\n        self.allHostsMustBeEvaluated = allHostsMustBeEvaluated\n        self.evaluators = evaluators\n    }\n\n    /// Returns the `ServerTrustEvaluating` value for the given host, if one is set.\n    ///\n    /// By default, this method will return the policy that perfectly matches the given host. Subclasses could override\n    /// this method and implement more complex mapping implementations such as wildcards.\n    ///\n    /// - Parameter host: The host to use when searching for a matching policy.\n    ///\n    /// - Returns:        The `ServerTrustEvaluating` value for the given host if found, `nil` otherwise.\n    /// - Throws:         `AFError.serverTrustEvaluationFailed` if `allHostsMustBeEvaluated` is `true` and no matching\n    ///                   evaluators are found.\n    open func serverTrustEvaluator(forHost host: String) throws -> ServerTrustEvaluating? {\n        guard let evaluator = evaluators[host] else {\n            if allHostsMustBeEvaluated {\n                throw AFError.serverTrustEvaluationFailed(reason: .noRequiredEvaluator(host: host))\n            }\n\n            return nil\n        }\n\n        return evaluator\n    }\n}\n\n/// A protocol describing the API used to evaluate server trusts.\npublic protocol ServerTrustEvaluating {\n    #if os(Linux)\n    // Implement this once Linux has API for evaluating server trusts.\n    #else\n    /// Evaluates the given `SecTrust` value for the given `host`.\n    ///\n    /// - Parameters:\n    ///   - trust: The `SecTrust` value to evaluate.\n    ///   - host:  The host for which to evaluate the `SecTrust` value.\n    ///\n    /// - Returns: A `Bool` indicating whether the evaluator considers the `SecTrust` value valid for `host`.\n    func evaluate(_ trust: SecTrust, forHost host: String) throws\n    #endif\n}\n\n// MARK: - Server Trust Evaluators\n\n/// An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the\n/// host provided by the challenge. Applications are encouraged to always validate the host in production environments\n/// to guarantee the validity of the server's certificate chain.\npublic final class DefaultTrustEvaluator: ServerTrustEvaluating {\n    private let validateHost: Bool\n\n    /// Creates a `DefaultTrustEvaluator`.\n    ///\n    /// - Parameter validateHost: Determines whether or not the evaluator should validate the host. `true` by default.\n    public init(validateHost: Bool = true) {\n        self.validateHost = validateHost\n    }\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        if validateHost {\n            try trust.af.performValidation(forHost: host)\n        }\n\n        try trust.af.performDefaultValidation(forHost: host)\n    }\n}\n\n/// An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate\n/// the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates.\n/// Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS\n/// 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production\n/// environments to guarantee the validity of the server's certificate chain.\npublic final class RevocationTrustEvaluator: ServerTrustEvaluating {\n    /// Represents the options to be use when evaluating the status of a certificate.\n    /// Only Revocation Policy Constants are valid, and can be found in [Apple's documentation](https://developer.apple.com/documentation/security/certificate_key_and_trust_services/policies/1563600-revocation_policy_constants).\n    public struct Options: OptionSet {\n        /// Perform revocation checking using the CRL (Certification Revocation List) method.\n        public static let crl = Options(rawValue: kSecRevocationCRLMethod)\n        /// Consult only locally cached replies; do not use network access.\n        public static let networkAccessDisabled = Options(rawValue: kSecRevocationNetworkAccessDisabled)\n        /// Perform revocation checking using OCSP (Online Certificate Status Protocol).\n        public static let ocsp = Options(rawValue: kSecRevocationOCSPMethod)\n        /// Prefer CRL revocation checking over OCSP; by default, OCSP is preferred.\n        public static let preferCRL = Options(rawValue: kSecRevocationPreferCRL)\n        /// Require a positive response to pass the policy. If the flag is not set, revocation checking is done on a\n        /// \"best attempt\" basis, where failure to reach the server is not considered fatal.\n        public static let requirePositiveResponse = Options(rawValue: kSecRevocationRequirePositiveResponse)\n        /// Perform either OCSP or CRL checking. The checking is performed according to the method(s) specified in the\n        /// certificate and the value of `preferCRL`.\n        public static let any = Options(rawValue: kSecRevocationUseAnyAvailableMethod)\n\n        /// The raw value of the option.\n        public let rawValue: CFOptionFlags\n\n        /// Creates an `Options` value with the given `CFOptionFlags`.\n        ///\n        /// - Parameter rawValue: The `CFOptionFlags` value to initialize with.\n        public init(rawValue: CFOptionFlags) {\n            self.rawValue = rawValue\n        }\n    }\n\n    private let performDefaultValidation: Bool\n    private let validateHost: Bool\n    private let options: Options\n\n    /// Creates a `RevocationTrustEvaluator`.\n    ///\n    /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use\n    ///         `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.\n    ///\n    /// - Parameters:\n    ///   - performDefaultValidation:     Determines whether default validation should be performed in addition to\n    ///                                   evaluating the pinned certificates. `true` by default.\n    ///   - validateHost:                 Determines whether or not the evaluator should validate the host, in addition\n    ///                                   to performing the default evaluation, even if `performDefaultValidation` is\n    ///                                   `false`. `true` by default.\n    ///   - options:                      The `Options` to use to check the revocation status of the certificate. `.any`\n    ///                                   by default.\n    public init(performDefaultValidation: Bool = true, validateHost: Bool = true, options: Options = .any) {\n        self.performDefaultValidation = performDefaultValidation\n        self.validateHost = validateHost\n        self.options = options\n    }\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        if performDefaultValidation {\n            try trust.af.performDefaultValidation(forHost: host)\n        }\n\n        if validateHost {\n            try trust.af.performValidation(forHost: host)\n        }\n\n        if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {\n            try trust.af.evaluate(afterApplying: SecPolicy.af.revocation(options: options))\n        } else {\n            try trust.af.validate(policy: SecPolicy.af.revocation(options: options)) { status, result in\n                AFError.serverTrustEvaluationFailed(reason: .revocationCheckFailed(output: .init(host, trust, status, result), options: options))\n            }\n        }\n    }\n}\n\n/// Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned\n/// certificates match one of the server certificates. By validating both the certificate chain and host, certificate\n/// pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks.\n/// Applications are encouraged to always validate the host and require a valid certificate chain in production\n/// environments.\npublic final class PinnedCertificatesTrustEvaluator: ServerTrustEvaluating {\n    private let certificates: [SecCertificate]\n    private let acceptSelfSignedCertificates: Bool\n    private let performDefaultValidation: Bool\n    private let validateHost: Bool\n\n    /// Creates a `PinnedCertificatesTrustEvaluator`.\n    ///\n    /// - Parameters:\n    ///   - certificates:                 The certificates to use to evaluate the trust. All `cer`, `crt`, and `der`\n    ///                                   certificates in `Bundle.main` by default.\n    ///   - acceptSelfSignedCertificates: Adds the provided certificates as anchors for the trust evaluation, allowing\n    ///                                   self-signed certificates to pass. `false` by default. THIS SETTING SHOULD BE\n    ///                                   FALSE IN PRODUCTION!\n    ///   - performDefaultValidation:     Determines whether default validation should be performed in addition to\n    ///                                   evaluating the pinned certificates. `true` by default.\n    ///   - validateHost:                 Determines whether or not the evaluator should validate the host, in addition\n    ///                                   to performing the default evaluation, even if `performDefaultValidation` is\n    ///                                   `false`. `true` by default.\n    public init(certificates: [SecCertificate] = Bundle.main.af.certificates,\n                acceptSelfSignedCertificates: Bool = false,\n                performDefaultValidation: Bool = true,\n                validateHost: Bool = true) {\n        self.certificates = certificates\n        self.acceptSelfSignedCertificates = acceptSelfSignedCertificates\n        self.performDefaultValidation = performDefaultValidation\n        self.validateHost = validateHost\n    }\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        guard !certificates.isEmpty else {\n            throw AFError.serverTrustEvaluationFailed(reason: .noCertificatesFound)\n        }\n\n        if acceptSelfSignedCertificates {\n            try trust.af.setAnchorCertificates(certificates)\n        }\n\n        if performDefaultValidation {\n            try trust.af.performDefaultValidation(forHost: host)\n        }\n\n        if validateHost {\n            try trust.af.performValidation(forHost: host)\n        }\n\n        let serverCertificatesData = Set(trust.af.certificateData)\n        let pinnedCertificatesData = Set(certificates.af.data)\n        let pinnedCertificatesInServerData = !serverCertificatesData.isDisjoint(with: pinnedCertificatesData)\n        if !pinnedCertificatesInServerData {\n            throw AFError.serverTrustEvaluationFailed(reason: .certificatePinningFailed(host: host,\n                                                                                        trust: trust,\n                                                                                        pinnedCertificates: certificates,\n                                                                                        serverCertificates: trust.af.certificates))\n        }\n    }\n}\n\n/// Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned\n/// public keys match one of the server certificate public keys. By validating both the certificate chain and host,\n/// public key pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks.\n/// Applications are encouraged to always validate the host and require a valid certificate chain in production\n/// environments.\npublic final class PublicKeysTrustEvaluator: ServerTrustEvaluating {\n    private let keys: [SecKey]\n    private let performDefaultValidation: Bool\n    private let validateHost: Bool\n\n    /// Creates a `PublicKeysTrustEvaluator`.\n    ///\n    /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use\n    ///         `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.\n    ///\n    /// - Parameters:\n    ///   - keys:                     The `SecKey`s to use to validate public keys. Defaults to the public keys of all\n    ///                               certificates included in the main bundle.\n    ///   - performDefaultValidation: Determines whether default validation should be performed in addition to\n    ///                               evaluating the pinned certificates. `true` by default.\n    ///   - validateHost:             Determines whether or not the evaluator should validate the host, in addition to\n    ///                               performing the default evaluation, even if `performDefaultValidation` is `false`.\n    ///                               `true` by default.\n    public init(keys: [SecKey] = Bundle.main.af.publicKeys,\n                performDefaultValidation: Bool = true,\n                validateHost: Bool = true) {\n        self.keys = keys\n        self.performDefaultValidation = performDefaultValidation\n        self.validateHost = validateHost\n    }\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        guard !keys.isEmpty else {\n            throw AFError.serverTrustEvaluationFailed(reason: .noPublicKeysFound)\n        }\n\n        if performDefaultValidation {\n            try trust.af.performDefaultValidation(forHost: host)\n        }\n\n        if validateHost {\n            try trust.af.performValidation(forHost: host)\n        }\n\n        let pinnedKeysInServerKeys: Bool = {\n            for serverPublicKey in trust.af.publicKeys {\n                for pinnedPublicKey in keys {\n                    if serverPublicKey == pinnedPublicKey {\n                        return true\n                    }\n                }\n            }\n            return false\n        }()\n\n        if !pinnedKeysInServerKeys {\n            throw AFError.serverTrustEvaluationFailed(reason: .publicKeyPinningFailed(host: host,\n                                                                                      trust: trust,\n                                                                                      pinnedKeys: keys,\n                                                                                      serverKeys: trust.af.publicKeys))\n        }\n    }\n}\n\n/// Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the\n/// evaluators consider it valid.\npublic final class CompositeTrustEvaluator: ServerTrustEvaluating {\n    private let evaluators: [ServerTrustEvaluating]\n\n    /// Creates a `CompositeTrustEvaluator`.\n    ///\n    /// - Parameter evaluators: The `ServerTrustEvaluating` values used to evaluate the server trust.\n    public init(evaluators: [ServerTrustEvaluating]) {\n        self.evaluators = evaluators\n    }\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        try evaluators.evaluate(trust, forHost: host)\n    }\n}\n\n/// Disables all evaluation which in turn will always consider any server trust as valid.\n///\n/// **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**\npublic final class DisabledEvaluator: ServerTrustEvaluating {\n    /// Creates an instance.\n    public init() {}\n\n    public func evaluate(_ trust: SecTrust, forHost host: String) throws {}\n}\n\n// MARK: - Extensions\n\npublic extension Array where Element == ServerTrustEvaluating {\n    #if os(Linux)\n    // Add this same convenience method for Linux.\n    #else\n    /// Evaluates the given `SecTrust` value for the given `host`.\n    ///\n    /// - Parameters:\n    ///   - trust: The `SecTrust` value to evaluate.\n    ///   - host:  The host for which to evaluate the `SecTrust` value.\n    ///\n    /// - Returns: Whether or not the evaluator considers the `SecTrust` value valid for `host`.\n    func evaluate(_ trust: SecTrust, forHost host: String) throws {\n        for evaluator in self {\n            try evaluator.evaluate(trust, forHost: host)\n        }\n    }\n    #endif\n}\n\nextension Bundle: AlamofireExtended {}\npublic extension AlamofireExtension where ExtendedType: Bundle {\n    /// Returns all valid `cer`, `crt`, and `der` certificates in the bundle.\n    var certificates: [SecCertificate] {\n        return paths(forResourcesOfTypes: [\".cer\", \".CER\", \".crt\", \".CRT\", \".der\", \".DER\"]).compactMap { path in\n            guard\n                let certificateData = try? Data(contentsOf: URL(fileURLWithPath: path)) as CFData,\n                let certificate = SecCertificateCreateWithData(nil, certificateData) else { return nil }\n\n            return certificate\n        }\n    }\n\n    /// Returns all public keys for the valid certificates in the bundle.\n    var publicKeys: [SecKey] {\n        return certificates.af.publicKeys\n    }\n\n    /// Returns all pathnames for the resources identified by the provided file extensions.\n    ///\n    /// - Parameter types: The filename extensions locate.\n    ///\n    /// - Returns:         All pathnames for the given filename extensions.\n    func paths(forResourcesOfTypes types: [String]) -> [String] {\n        return Array(Set(types.flatMap { type.paths(forResourcesOfType: $0, inDirectory: nil) }))\n    }\n}\n\nextension SecTrust: AlamofireExtended {}\npublic extension AlamofireExtension where ExtendedType == SecTrust {\n    /// Evaluates `self` after applying the `SecPolicy` value provided.\n    ///\n    /// - Parameter policy: The `SecPolicy` to apply to `self` before evaluation.\n    ///\n    /// - Throws:           Any `Error` from applying the `SecPolicy` or from evaluation.\n    @available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)\n    func evaluate(afterApplying policy: SecPolicy) throws {\n        try apply(policy: policy).af.evaluate()\n    }\n\n    /// Attempts to validate `self` using the `SecPolicy` provided and transforming any error produced using the closure passed.\n    ///\n    /// - Parameters:\n    ///   - policy:        The `SecPolicy` used to evaluate `self`.\n    ///   - errorProducer: The closure used transform the failed `OSStatus` and `SecTrustResultType`.\n    /// - Throws:          Any `Error` from applying the `policy`, or the result of `errorProducer` if validation fails.\n    @available(iOS, introduced: 10, deprecated: 12, renamed: \"evaluate(afterApplying:)\")\n    @available(macOS, introduced: 10.12, deprecated: 10.14, renamed: \"evaluate(afterApplying:)\")\n    @available(tvOS, introduced: 10, deprecated: 12, renamed: \"evaluate(afterApplying:)\")\n    @available(watchOS, introduced: 3, deprecated: 5, renamed: \"evaluate(afterApplying:)\")\n    func validate(policy: SecPolicy, errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws {\n        try apply(policy: policy).af.validate(errorProducer: errorProducer)\n    }\n\n    /// Applies a `SecPolicy` to `self`, throwing if it fails.\n    ///\n    /// - Parameter policy: The `SecPolicy`.\n    ///\n    /// - Returns: `self`, with the policy applied.\n    /// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.policyApplicationFailed` reason.\n    func apply(policy: SecPolicy) throws -> SecTrust {\n        let status = SecTrustSetPolicies(type, policy)\n\n        guard status.af.isSuccess else {\n            throw AFError.serverTrustEvaluationFailed(reason: .policyApplicationFailed(trust: type,\n                                                                                       policy: policy,\n                                                                                       status: status))\n        }\n\n        return type\n    }\n\n    /// Evaluate `self`, throwing an `Error` if evaluation fails.\n    ///\n    /// - Throws: `AFError.serverTrustEvaluationFailed` with reason `.trustValidationFailed` and associated error from\n    ///           the underlying evaluation.\n    @available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)\n    func evaluate() throws {\n        var error: CFError?\n        let evaluationSucceeded = SecTrustEvaluateWithError(type, &error)\n\n        if !evaluationSucceeded {\n            throw AFError.serverTrustEvaluationFailed(reason: .trustEvaluationFailed(error: error))\n        }\n    }\n\n    /// Validate `self`, passing any failure values through `errorProducer`.\n    ///\n    /// - Parameter errorProducer: The closure used to transform the failed `OSStatus` and `SecTrustResultType` into an\n    ///                            `Error`.\n    /// - Throws:                  The `Error` produced by the `errorProducer` closure.\n    @available(iOS, introduced: 10, deprecated: 12, renamed: \"evaluate()\")\n    @available(macOS, introduced: 10.12, deprecated: 10.14, renamed: \"evaluate()\")\n    @available(tvOS, introduced: 10, deprecated: 12, renamed: \"evaluate()\")\n    @available(watchOS, introduced: 3, deprecated: 5, renamed: \"evaluate()\")\n    func validate(errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws {\n        var result = SecTrustResultType.invalid\n        let status = SecTrustEvaluate(type, &result)\n\n        guard status.af.isSuccess && result.af.isSuccess else {\n            throw errorProducer(status, result)\n        }\n    }\n\n    /// Sets a custom certificate chain on `self`, allowing full validation of a self-signed certificate and its chain.\n    ///\n    /// - Parameter certificates: The `SecCertificate`s to add to the chain.\n    /// - Throws:                 Any error produced when applying the new certificate chain.\n    func setAnchorCertificates(_ certificates: [SecCertificate]) throws {\n        // Add additional anchor certificates.\n        let status = SecTrustSetAnchorCertificates(type, certificates as CFArray)\n        guard status.af.isSuccess else {\n            throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: status,\n                                                                                               certificates: certificates))\n        }\n\n        // Reenable system anchor certificates.\n        let systemStatus = SecTrustSetAnchorCertificatesOnly(type, true)\n        guard systemStatus.af.isSuccess else {\n            throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: systemStatus,\n                                                                                               certificates: certificates))\n        }\n    }\n\n    /// The public keys contained in `self`.\n    var publicKeys: [SecKey] {\n        return certificates.af.publicKeys\n    }\n\n    /// The `SecCertificate`s contained i `self`.\n    var certificates: [SecCertificate] {\n        return (0..<SecTrustGetCertificateCount(type)).compactMap { index in\n            SecTrustGetCertificateAtIndex(type, index)\n        }\n    }\n\n    /// The `Data` values for all certificates contained in `self`.\n    var certificateData: [Data] {\n        return certificates.af.data\n    }\n\n    /// Validates `self` after applying `SecPolicy.af.default`. This evaluation does not validate the hostname.\n    ///\n    /// - Parameter host: The hostname, used only in the error output if validation fails.\n    /// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.defaultEvaluationFailed` reason.\n    func performDefaultValidation(forHost host: String) throws {\n        if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {\n            try evaluate(afterApplying: SecPolicy.af.default)\n        } else {\n            try validate(policy: SecPolicy.af.default) { status, result in\n                AFError.serverTrustEvaluationFailed(reason: .defaultEvaluationFailed(output: .init(host, type, status, result)))\n            }\n        }\n    }\n\n    /// Validates `self` after applying `SecPolicy.af.hostname(host)`, which performs the default validation as well as\n    /// hostname validation.\n    ///\n    /// - Parameter host: The hostname to use in the validation.\n    /// - Throws:         An `AFError.serverTrustEvaluationFailed` instance with a `.defaultEvaluationFailed` reason.\n    func performValidation(forHost host: String) throws {\n        if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {\n            try evaluate(afterApplying: SecPolicy.af.hostname(host))\n        } else {\n            try validate(policy: SecPolicy.af.hostname(host)) { status, result in\n                AFError.serverTrustEvaluationFailed(reason: .hostValidationFailed(output: .init(host, type, status, result)))\n            }\n        }\n    }\n}\n\nextension SecPolicy: AlamofireExtended {}\npublic extension AlamofireExtension where ExtendedType == SecPolicy {\n    /// Creates a `SecPolicy` instance which will validate server certificates but not require a host name match.\n    static let `default` = SecPolicyCreateSSL(true, nil)\n\n    /// Creates a `SecPolicy` instance which will validate server certificates and much match the provided hostname.\n    ///\n    /// - Parameter hostname: The hostname to validate against.\n    ///\n    /// - Returns:            The `SecPolicy`.\n    static func hostname(_ hostname: String) -> SecPolicy {\n        return SecPolicyCreateSSL(true, hostname as CFString)\n    }\n\n    /// Creates a `SecPolicy` which checks the revocation of certificates.\n    ///\n    /// - Parameter options: The `RevocationTrustEvaluator.Options` for evaluation.\n    ///\n    /// - Returns:           The `SecPolicy`.\n    /// - Throws:            An `AFError.serverTrustEvaluationFailed` error with reason `.revocationPolicyCreationFailed`\n    ///                      if the policy cannot be created.\n    static func revocation(options: RevocationTrustEvaluator.Options) throws -> SecPolicy {\n        guard let policy = SecPolicyCreateRevocation(options.rawValue) else {\n            throw AFError.serverTrustEvaluationFailed(reason: .revocationPolicyCreationFailed)\n        }\n\n        return policy\n    }\n}\n\nextension Array: AlamofireExtended {}\npublic extension AlamofireExtension where ExtendedType == [SecCertificate] {\n    /// All `Data` values for the contained `SecCertificate`s.\n    var data: [Data] {\n        return type.map { SecCertificateCopyData($0) as Data }\n    }\n\n    /// All public `SecKey` values for the contained `SecCertificate`s.\n    var publicKeys: [SecKey] {\n        return type.compactMap { $0.af.publicKey }\n    }\n}\n\nextension SecCertificate: AlamofireExtended {}\npublic extension AlamofireExtension where ExtendedType == SecCertificate {\n    /// The public key for `self`, if it can be extracted.\n    var publicKey: SecKey? {\n        let policy = SecPolicyCreateBasicX509()\n        var trust: SecTrust?\n        let trustCreationStatus = SecTrustCreateWithCertificates(type, policy, &trust)\n\n        guard let createdTrust = trust, trustCreationStatus == errSecSuccess else { return nil }\n\n        return SecTrustCopyPublicKey(createdTrust)\n    }\n}\n\nextension OSStatus: AlamofireExtended {}\npublic extension AlamofireExtension where ExtendedType == OSStatus {\n    /// Returns whether `self` is `errSecSuccess`.\n    var isSuccess: Bool { return type == errSecSuccess }\n}\n\nextension SecTrustResultType: AlamofireExtended {}\npublic extension AlamofireExtension where ExtendedType == SecTrustResultType {\n    /// Returns whether `self is `.unspecified` or `.proceed`.\n    var isSuccess: Bool {\n        return (type == .unspecified || type == .proceed)\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/Session.swift",
    "content": "//\n//  Session.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// `Session` creates and manages Alamofire's `Request` types during their lifetimes. It also provides common\n/// functionality for all `Request`s, including queuing, interception, trust management, redirect handling, and response\n/// cache handling.\nopen class Session {\n    /// Shared singleton instance used by all `AF.request` APIs. Cannot be modified.\n    public static let `default` = Session()\n\n    /// Underlying `URLSession` used to create `URLSessionTasks` for this instance, and for which this instance's\n    /// `delegate` handles `URLSessionDelegate` callbacks.\n    public let session: URLSession\n    /// Instance's `SessionDelegate`, which handles the `URLSessionDelegate` methods and `Request` interaction.\n    public let delegate: SessionDelegate\n    /// Root `DispatchQueue` for all internal callbacks and state update. **MUST** be a serial queue.\n    public let rootQueue: DispatchQueue\n    /// Value determining whether this instance automatically calls `resume()` on all created `Request`s.\n    public let startRequestsImmediately: Bool\n    /// `DispatchQueue` on which `URLRequest`s are created asynchronously. By default this queue uses `rootQueue` as its\n    /// `target`, but a separate queue can be used if request creation is determined to be a bottleneck. Always profile\n    /// and test before introducing an additional queue.\n    public let requestQueue: DispatchQueue\n    /// `DispatchQueue` passed to all `Request`s on which they perform their response serialization. By default this\n    /// queue uses `rootQueue` as its `target` but a separate queue can be used if response serialization is determined\n    /// to be a bottleneck. Always profile and test before introducing an additional queue.\n    public let serializationQueue: DispatchQueue\n    /// `RequestInterceptor` used for all `Request` created by the instance. `RequestInterceptor`s can also be set on a\n    /// per-`Request` basis, in which case the `Request`'s interceptor takes precedence over this value.\n    public let interceptor: RequestInterceptor?\n    /// `ServerTrustManager` instance used to evaluate all trust challenges and provide certificate and key pinning.\n    public let serverTrustManager: ServerTrustManager?\n    /// `RedirectHandler` instance used to provide customization for request redirection.\n    public let redirectHandler: RedirectHandler?\n    /// `CachedResponseHandler` instance used to provide customization of cached response handling.\n    public let cachedResponseHandler: CachedResponseHandler?\n    /// `CompositeEventMonitor` used to compose Alamofire's `defaultEventMonitors` and any passed `EventMonitor`s.\n    public let eventMonitor: CompositeEventMonitor\n    /// `EventMonitor`s included in all instances. `[AlamofireNotifications()]` by default.\n    public let defaultEventMonitors: [EventMonitor] = [AlamofireNotifications()]\n\n    /// Internal map between `Request`s and any `URLSessionTasks` that may be in flight for them.\n    var requestTaskMap = RequestTaskMap()\n    /// Set of currently active `Request`s.\n    var activeRequests: Set<Request> = []\n\n    /// Creates a `Session` from a `URLSession` and other parameters.\n    ///\n    /// - Note: When passing a `URLSession`, you must create the `URLSession` with a specific `delegateQueue` value and\n    ///         pass the `delegateQueue`'s `underlyingQueue` as the `rootQueue` parameter of this initializer.\n    ///\n    /// - Parameters:\n    ///   - session:                  Underlying `URLSession` for this instance.\n    ///   - delegate:                 `SessionDelegate` that handles `session`'s delegate callbacks as well as `Request`\n    ///                               interaction.\n    ///   - rootQueue:                Root `DispatchQueue` for all internal callbacks and state updates. **MUST** be a\n    ///                               serial queue.\n    ///   - startRequestsImmediately: Determines whether this instance will automatically start all `Request`s. `true`\n    ///                               by default. If set to `false`, all `Request`s created must have `.resume()` called.\n    ///                               on them for them to start.\n    ///   - requestQueue:             `DispatchQueue` on which to perform `URLRequest` creation. By default this queue\n    ///                               will use the `rootQueue` as its `target`. A separate queue can be used if it's\n    ///                               determined request creation is a bottleneck, but that should only be done after\n    ///                               careful testing and profiling. `nil` by default.\n    ///   - serializationQueue:       `DispatchQueue` on which to perform all response serialization. By default this\n    ///                               queue will use the `rootQueue` as its `target`. A separate queue can be used if\n    ///                               it's determined response serialization is a bottleneck, but that should only be\n    ///                               done after careful testing and profiling. `nil` by default.\n    ///   - interceptor:              `RequestInterceptor` to be used for all `Request`s created by this instance. `nil`\n    ///                               by default.\n    ///   - serverTrustManager:       `ServerTrustManager` to be used for all trust evaluations by this instance. `nil`\n    ///                               by default.\n    ///   - redirectHandler:          `RedirectHandler` to be used by all `Request`s created by this instance. `nil` by\n    ///                               default.\n    ///   - cachedResponseHandler:    `CachedResponseHandler` to be used by all `Request`s created by this instance.\n    ///                               `nil` by default.\n    ///   - eventMonitors:            Additional `EventMonitor`s used by the instance. Alamofire always adds a\n    ///                               `AlamofireNotifications` `EventMonitor` to the array passed here. `[]` by default.\n    public init(session: URLSession,\n                delegate: SessionDelegate,\n                rootQueue: DispatchQueue,\n                startRequestsImmediately: Bool = true,\n                requestQueue: DispatchQueue? = nil,\n                serializationQueue: DispatchQueue? = nil,\n                interceptor: RequestInterceptor? = nil,\n                serverTrustManager: ServerTrustManager? = nil,\n                redirectHandler: RedirectHandler? = nil,\n                cachedResponseHandler: CachedResponseHandler? = nil,\n                eventMonitors: [EventMonitor] = []) {\n        precondition(session.configuration.identifier == nil,\n                     \"Alamofire does not support background URLSessionConfigurations.\")\n        precondition(session.delegateQueue.underlyingQueue === rootQueue,\n                     \"Session(session:) initializer must be passed the DispatchQueue used as the delegateQueue's underlyingQueue as rootQueue.\")\n\n        self.session = session\n        self.delegate = delegate\n        self.rootQueue = rootQueue\n        self.startRequestsImmediately = startRequestsImmediately\n        self.requestQueue = requestQueue ?? DispatchQueue(label: \"\\(rootQueue.label).requestQueue\", target: rootQueue)\n        self.serializationQueue = serializationQueue ?? DispatchQueue(label: \"\\(rootQueue.label).serializationQueue\", target: rootQueue)\n        self.interceptor = interceptor\n        self.serverTrustManager = serverTrustManager\n        self.redirectHandler = redirectHandler\n        self.cachedResponseHandler = cachedResponseHandler\n        eventMonitor = CompositeEventMonitor(monitors: defaultEventMonitors + eventMonitors)\n        delegate.eventMonitor = eventMonitor\n        delegate.stateProvider = self\n    }\n\n    /// Creates a `Session` from a `URLSessionConfiguration`.\n    ///\n    /// - Note: This initializer lets Alamofire handle the creation of the underlying `URLSession` and its\n    ///         `delegateQueue`, and is the recommended initializer for most uses.\n    ///\n    /// - Parameters:\n    ///   - configuration:            `URLSessionConfiguration` to be used to create the underlying `URLSession`. Changes\n    ///                               to this value after being passed to this initializer will have no effect.\n    ///                               `URLSessionConfiguration.af.default` by default.\n    ///   - delegate:                 `SessionDelegate` that handles `session`'s delegate callbacks as well as `Request`\n    ///                               interaction. `SessionDelegate()` by default.\n    ///   - rootQueue:                Root `DispatchQueue` for all internal callbacks and state updates. **MUST** be a\n    ///                               serial queue. `DispatchQueue(label: \"org.alamofire.session.rootQueue\")` by default.\n    ///   - startRequestsImmediately: Determines whether this instance will automatically start all `Request`s. `true`\n    ///                               by default. If set to `false`, all `Request`s created must have `.resume()` called.\n    ///                               on them for them to start.\n    ///   - requestQueue:             `DispatchQueue` on which to perform `URLRequest` creation. By default this queue\n    ///                               will use the `rootQueue` as its `target`. A separate queue can be used if it's\n    ///                               determined request creation is a bottleneck, but that should only be done after\n    ///                               careful testing and profiling. `nil` by default.\n    ///   - serializationQueue:       `DispatchQueue` on which to perform all response serialization. By default this\n    ///                               queue will use the `rootQueue` as its `target`. A separate queue can be used if\n    ///                               it's determined response serialization is a bottleneck, but that should only be\n    ///                               done after careful testing and profiling. `nil` by default.\n    ///   - interceptor:              `RequestInterceptor` to be used for all `Request`s created by this instance. `nil`\n    ///                               by default.\n    ///   - serverTrustManager:       `ServerTrustManager` to be used for all trust evaluations by this instance. `nil`\n    ///                               by default.\n    ///   - redirectHandler:          `RedirectHandler` to be used by all `Request`s created by this instance. `nil` by\n    ///                               default.\n    ///   - cachedResponseHandler:    `CachedResponseHandler` to be used by all `Request`s created by this instance.\n    ///                               `nil` by default.\n    ///   - eventMonitors:            Additional `EventMonitor`s used by the instance. Alamofire always adds a\n    ///                               `AlamofireNotifications` `EventMonitor` to the array passed here. `[]` by default.\n    public convenience init(configuration: URLSessionConfiguration = URLSessionConfiguration.af.default,\n                            delegate: SessionDelegate = SessionDelegate(),\n                            rootQueue: DispatchQueue = DispatchQueue(label: \"org.alamofire.session.rootQueue\"),\n                            startRequestsImmediately: Bool = true,\n                            requestQueue: DispatchQueue? = nil,\n                            serializationQueue: DispatchQueue? = nil,\n                            interceptor: RequestInterceptor? = nil,\n                            serverTrustManager: ServerTrustManager? = nil,\n                            redirectHandler: RedirectHandler? = nil,\n                            cachedResponseHandler: CachedResponseHandler? = nil,\n                            eventMonitors: [EventMonitor] = []) {\n        precondition(configuration.identifier == nil, \"Alamofire does not support background URLSessionConfigurations.\")\n\n        let delegateQueue = OperationQueue(maxConcurrentOperationCount: 1, underlyingQueue: rootQueue, name: \"org.alamofire.session.sessionDelegateQueue\")\n        let session = URLSession(configuration: configuration, delegate: delegate, delegateQueue: delegateQueue)\n\n        self.init(session: session,\n                  delegate: delegate,\n                  rootQueue: rootQueue,\n                  startRequestsImmediately: startRequestsImmediately,\n                  requestQueue: requestQueue,\n                  serializationQueue: serializationQueue,\n                  interceptor: interceptor,\n                  serverTrustManager: serverTrustManager,\n                  redirectHandler: redirectHandler,\n                  cachedResponseHandler: cachedResponseHandler,\n                  eventMonitors: eventMonitors)\n    }\n\n    deinit {\n        finishRequestsForDeinit()\n        session.invalidateAndCancel()\n    }\n\n    // MARK: - Cancellation\n\n    /// Cancel all active `Request`s, optionally calling a completion handler when complete.\n    ///\n    /// - Note: This is an asynchronous operation and does not block the creation of future `Request`s. Cancelled\n    ///         `Request`s may not cancel immediately due internal work, and may not cancel at all if they are close to\n    ///         completion when cancelled.\n    ///\n    /// - Parameters:\n    ///   - queue:      `DispatchQueue` on which the completion handler is run. `.main` by default.\n    ///   - completion: Closure to be called when all `Request`s have been cancelled.\n    public func cancelAllRequests(completingOnQueue queue: DispatchQueue = .main, completion: (() -> Void)? = nil) {\n        rootQueue.async {\n            self.activeRequests.forEach { $0.cancel() }\n            queue.async { completion?() }\n        }\n    }\n\n    // MARK: - DataRequest\n\n    struct RequestConvertible: URLRequestConvertible {\n        let url: URLConvertible\n        let method: HTTPMethod\n        let parameters: Parameters?\n        let encoding: ParameterEncoding\n        let headers: HTTPHeaders?\n\n        func asURLRequest() throws -> URLRequest {\n            let request = try URLRequest(url: url, method: method, headers: headers)\n            return try encoding.encode(request, with: parameters)\n        }\n    }\n\n    /// Creates a `DataRequest` from a `URLRequest` created using the passed components and a `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible: `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:      `HTTPMethod` for the `URLRequest`. `.get` by default.\n    ///   - parameters:  `Parameters` (a.k.a. `[String: Any]`) value to be encoded into the `URLRequest`. `nil` by default.\n    ///   - encoding:    `ParameterEncoding` to be used to encode the `parameters` value into the `URLRequest`.\n    ///                  `URLEncoding.default` by default.\n    ///   - headers:     `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///\n    /// - Returns:       The created `DataRequest`.\n    open func request(_ convertible: URLConvertible,\n                      method: HTTPMethod = .get,\n                      parameters: Parameters? = nil,\n                      encoding: ParameterEncoding = URLEncoding.default,\n                      headers: HTTPHeaders? = nil,\n                      interceptor: RequestInterceptor? = nil) -> DataRequest {\n        let convertible = RequestConvertible(url: convertible,\n                                             method: method,\n                                             parameters: parameters,\n                                             encoding: encoding,\n                                             headers: headers)\n\n        return request(convertible, interceptor: interceptor)\n    }\n\n    struct RequestEncodableConvertible<Parameters: Encodable>: URLRequestConvertible {\n        let url: URLConvertible\n        let method: HTTPMethod\n        let parameters: Parameters?\n        let encoder: ParameterEncoder\n        let headers: HTTPHeaders?\n\n        func asURLRequest() throws -> URLRequest {\n            let request = try URLRequest(url: url, method: method, headers: headers)\n\n            return try parameters.map { try encoder.encode($0, into: request) } ?? request\n        }\n    }\n\n    /// Creates a `DataRequest` from a `URLRequest` created using the passed components, `Encodable` parameters, and a\n    /// `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible: `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:      `HTTPMethod` for the `URLRequest`. `.get` by default.\n    ///   - parameters:  `Encodable` value to be encoded into the `URLRequest`. `nil` by default.\n    ///   - encoder:     `ParameterEncoder` to be used to encode the `parameters` value into the `URLRequest`.\n    ///                  `URLEncodedFormParameterEncoder.default` by default.\n    ///   - headers:     `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///\n    /// - Returns:       The created `DataRequest`.\n    open func request<Parameters: Encodable>(_ convertible: URLConvertible,\n                                             method: HTTPMethod = .get,\n                                             parameters: Parameters? = nil,\n                                             encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default,\n                                             headers: HTTPHeaders? = nil,\n                                             interceptor: RequestInterceptor? = nil) -> DataRequest {\n        let convertible = RequestEncodableConvertible(url: convertible,\n                                                      method: method,\n                                                      parameters: parameters,\n                                                      encoder: encoder,\n                                                      headers: headers)\n\n        return request(convertible, interceptor: interceptor)\n    }\n\n    /// Creates a `DataRequest` from a `URLRequestConvertible` value and a `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible: `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///\n    /// - Returns:       The created `DataRequest`.\n    open func request(_ convertible: URLRequestConvertible, interceptor: RequestInterceptor? = nil) -> DataRequest {\n        let request = DataRequest(convertible: convertible,\n                                  underlyingQueue: rootQueue,\n                                  serializationQueue: serializationQueue,\n                                  eventMonitor: eventMonitor,\n                                  interceptor: interceptor,\n                                  delegate: self)\n\n        perform(request)\n\n        return request\n    }\n\n    // MARK: - DownloadRequest\n\n    /// Creates a `DownloadRequest` using a `URLRequest` created using the passed components, `RequestInterceptor`, and\n    /// `Destination`.\n    ///\n    /// - Parameters:\n    ///   - convertible: `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:      `HTTPMethod` for the `URLRequest`. `.get` by default.\n    ///   - parameters:  `Parameters` (a.k.a. `[String: Any]`) value to be encoded into the `URLRequest`. `nil` by default.\n    ///   - encoding:    `ParameterEncoding` to be used to encode the `parameters` value into the `URLRequest`. Defaults\n    ///                  to `URLEncoding.default`.\n    ///   - headers:     `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - destination: `DownloadRequest.Destination` closure used to determine how and where the downloaded file\n    ///                  should be moved. `nil` by default.\n    ///\n    /// - Returns:       The created `DownloadRequest`.\n    open func download(_ convertible: URLConvertible,\n                       method: HTTPMethod = .get,\n                       parameters: Parameters? = nil,\n                       encoding: ParameterEncoding = URLEncoding.default,\n                       headers: HTTPHeaders? = nil,\n                       interceptor: RequestInterceptor? = nil,\n                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {\n        let convertible = RequestConvertible(url: convertible,\n                                             method: method,\n                                             parameters: parameters,\n                                             encoding: encoding,\n                                             headers: headers)\n\n        return download(convertible, interceptor: interceptor, to: destination)\n    }\n\n    /// Creates a `DownloadRequest` from a `URLRequest` created using the passed components, `Encodable` parameters, and\n    /// a `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - convertible: `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:      `HTTPMethod` for the `URLRequest`. `.get` by default.\n    ///   - parameters:  Value conforming to `Encodable` to be encoded into the `URLRequest`. `nil` by default.\n    ///   - encoder:     `ParameterEncoder` to be used to encode the `parameters` value into the `URLRequest`. Defaults\n    ///                  to `URLEncodedFormParameterEncoder.default`.\n    ///   - headers:     `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - destination: `DownloadRequest.Destination` closure used to determine how and where the downloaded file\n    ///                  should be moved. `nil` by default.\n    ///\n    /// - Returns:       The created `DownloadRequest`.\n    open func download<Parameters: Encodable>(_ convertible: URLConvertible,\n                                              method: HTTPMethod = .get,\n                                              parameters: Parameters? = nil,\n                                              encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default,\n                                              headers: HTTPHeaders? = nil,\n                                              interceptor: RequestInterceptor? = nil,\n                                              to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {\n        let convertible = RequestEncodableConvertible(url: convertible,\n                                                      method: method,\n                                                      parameters: parameters,\n                                                      encoder: encoder,\n                                                      headers: headers)\n\n        return download(convertible, interceptor: interceptor, to: destination)\n    }\n\n    /// Creates a `DownloadRequest` from a `URLRequestConvertible` value, a `RequestInterceptor`, and a `Destination`.\n    ///\n    /// - Parameters:\n    ///   - convertible: `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - destination: `DownloadRequest.Destination` closure used to determine how and where the downloaded file\n    ///                  should be moved. `nil` by default.\n    ///\n    /// - Returns:       The created `DownloadRequest`.\n    open func download(_ convertible: URLRequestConvertible,\n                       interceptor: RequestInterceptor? = nil,\n                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {\n        let request = DownloadRequest(downloadable: .request(convertible),\n                                      underlyingQueue: rootQueue,\n                                      serializationQueue: serializationQueue,\n                                      eventMonitor: eventMonitor,\n                                      interceptor: interceptor,\n                                      delegate: self,\n                                      destination: destination ?? DownloadRequest.defaultDestination)\n\n        perform(request)\n\n        return request\n    }\n\n    /// Creates a `DownloadRequest` from the `resumeData` produced from a previously cancelled `DownloadRequest`, as\n    /// well as a `RequestInterceptor`, and a `Destination`.\n    ///\n    /// - Note: If `destination` is not specified, the download will be moved to a temporary location determined by\n    ///         Alamofire. The file will not be deleted until the system purges the temporary files.\n    ///\n    /// - Note: On some versions of all Apple platforms (iOS 10 - 10.2, macOS 10.12 - 10.12.2, tvOS 10 - 10.1, watchOS 3 - 3.1.1),\n    /// `resumeData` is broken on background URL session configurations. There's an underlying bug in the `resumeData`\n    /// generation logic where the data is written incorrectly and will always fail to resume the download. For more\n    /// information about the bug and possible workarounds, please refer to the [this Stack Overflow post](http://stackoverflow.com/a/39347461/1342462).\n    ///\n    /// - Parameters:\n    ///   - data:        The resume data from a previously cancelled `DownloadRequest` or `URLSessionDownloadTask`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - destination: `DownloadRequest.Destination` closure used to determine how and where the downloaded file\n    ///                  should be moved. `nil` by default.\n    ///\n    /// - Returns:       The created `DownloadRequest`.\n    open func download(resumingWith data: Data,\n                       interceptor: RequestInterceptor? = nil,\n                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {\n        let request = DownloadRequest(downloadable: .resumeData(data),\n                                      underlyingQueue: rootQueue,\n                                      serializationQueue: serializationQueue,\n                                      eventMonitor: eventMonitor,\n                                      interceptor: interceptor,\n                                      delegate: self,\n                                      destination: destination ?? DownloadRequest.defaultDestination)\n\n        perform(request)\n\n        return request\n    }\n\n    // MARK: - UploadRequest\n\n    struct ParameterlessRequestConvertible: URLRequestConvertible {\n        let url: URLConvertible\n        let method: HTTPMethod\n        let headers: HTTPHeaders?\n\n        func asURLRequest() throws -> URLRequest {\n            return try URLRequest(url: url, method: method, headers: headers)\n        }\n    }\n\n    struct Upload: UploadConvertible {\n        let request: URLRequestConvertible\n        let uploadable: UploadableConvertible\n\n        func createUploadable() throws -> UploadRequest.Uploadable {\n            return try uploadable.createUploadable()\n        }\n\n        func asURLRequest() throws -> URLRequest {\n            return try request.asURLRequest()\n        }\n    }\n\n    // MARK: Data\n\n    /// Creates an `UploadRequest` for the given `Data`, `URLRequest` components, and `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - data:        The `Data` to upload.\n    ///   - convertible: `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:      `HTTPMethod` for the `URLRequest`. `.post` by default.\n    ///   - headers:     `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager: `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                  default.\n    ///\n    /// - Returns:       The created `UploadRequest`.\n    open func upload(_ data: Data,\n                     to convertible: URLConvertible,\n                     method: HTTPMethod = .post,\n                     headers: HTTPHeaders? = nil,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        let convertible = ParameterlessRequestConvertible(url: convertible, method: method, headers: headers)\n\n        return upload(data, with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` for the given `Data` using the `URLRequestConvertible` value and `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - data:        The `Data` to upload.\n    ///   - convertible: `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager: `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                  default.\n    ///\n    /// - Returns:       The created `UploadRequest`.\n    open func upload(_ data: Data,\n                     with convertible: URLRequestConvertible,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        return upload(.data(data), with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    // MARK: File\n\n    /// Creates an `UploadRequest` for the file at the given file `URL`, using a `URLRequest` from the provided\n    /// components and `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - fileURL:     The `URL` of the file to upload.\n    ///   - convertible: `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:      `HTTPMethod` for the `URLRequest`. `.post` by default.\n    ///   - headers:     `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `UploadRequest`. `nil` by default.\n    ///   - fileManager: `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                  default.\n    ///\n    /// - Returns:       The created `UploadRequest`.\n    open func upload(_ fileURL: URL,\n                     to convertible: URLConvertible,\n                     method: HTTPMethod = .post,\n                     headers: HTTPHeaders? = nil,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        let convertible = ParameterlessRequestConvertible(url: convertible, method: method, headers: headers)\n\n        return upload(fileURL, with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` for the file at the given file `URL` using the `URLRequestConvertible` value and\n    /// `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - fileURL:     The `URL` of the file to upload.\n    ///   - convertible: `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager: `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                  default.\n    ///\n    /// - Returns:       The created `UploadRequest`.\n    open func upload(_ fileURL: URL,\n                     with convertible: URLRequestConvertible,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        return upload(.file(fileURL, shouldRemove: false), with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    // MARK: InputStream\n\n    /// Creates an `UploadRequest` from the `InputStream` provided using a `URLRequest` from the provided components and\n    /// `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - stream:      The `InputStream` that provides the data to upload.\n    ///   - convertible: `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - method:      `HTTPMethod` for the `URLRequest`. `.post` by default.\n    ///   - headers:     `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager: `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                  default.\n    ///\n    /// - Returns:       The created `UploadRequest`.\n    open func upload(_ stream: InputStream,\n                     to convertible: URLConvertible,\n                     method: HTTPMethod = .post,\n                     headers: HTTPHeaders? = nil,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        let convertible = ParameterlessRequestConvertible(url: convertible, method: method, headers: headers)\n\n        return upload(stream, with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` from the provided `InputStream` using the `URLRequestConvertible` value and\n    /// `RequestInterceptor`.\n    ///\n    /// - Parameters:\n    ///   - stream:      The `InputStream` that provides the data to upload.\n    ///   - convertible: `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - interceptor: `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager: `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                  default.\n    ///\n    /// - Returns:       The created `UploadRequest`.\n    open func upload(_ stream: InputStream,\n                     with convertible: URLRequestConvertible,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        return upload(.stream(stream), with: convertible, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    // MARK: MultipartFormData\n\n    /// Creates an `UploadRequest` for the multipart form data built using a closure and sent using the provided\n    /// `URLRequest` components and `RequestInterceptor`.\n    ///\n    /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\n    /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most\n    /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\n    /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\n    /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\n    /// used for larger payloads such as video content.\n    ///\n    /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\n    /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\n    /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\n    /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\n    /// technique was used.\n    ///\n    /// - Parameters:\n    ///   - multipartFormData:       `MultipartFormData` building closure.\n    ///   - convertible:             `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or\n    ///                              onto disk before being uploaded. `MultipartFormData.encodingMemoryThreshold` by\n    ///                              default.\n    ///   - method:                  `HTTPMethod` for the `URLRequest`. `.post` by default.\n    ///   - headers:                 `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:             `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager:             `FileManager` to be used if the form data exceeds the memory threshold and is\n    ///                              written to disk before being uploaded. `.default` instance by default.\n    ///\n    /// - Returns:                   The created `UploadRequest`.\n    open func upload(multipartFormData: @escaping (MultipartFormData) -> Void,\n                     to url: URLConvertible,\n                     usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,\n                     method: HTTPMethod = .post,\n                     headers: HTTPHeaders? = nil,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        let convertible = ParameterlessRequestConvertible(url: url, method: method, headers: headers)\n\n        let formData = MultipartFormData(fileManager: fileManager)\n        multipartFormData(formData)\n\n        return upload(multipartFormData: formData,\n                      with: convertible,\n                      usingThreshold: encodingMemoryThreshold,\n                      interceptor: interceptor,\n                      fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` using a `MultipartFormData` building closure, the provided `URLRequestConvertible`\n    /// value, and a `RequestInterceptor`.\n    ///\n    /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\n    /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most\n    /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\n    /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\n    /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\n    /// used for larger payloads such as video content.\n    ///\n    /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\n    /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\n    /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\n    /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\n    /// technique was used.\n    ///\n    /// - Parameters:\n    ///   - multipartFormData:       `MultipartFormData` building closure.\n    ///   - request:                 `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or\n    ///                              onto disk before being uploaded. `MultipartFormData.encodingMemoryThreshold` by\n    ///                              default.\n    ///   - interceptor:             `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager:             `FileManager` to be used if the form data exceeds the memory threshold and is\n    ///                              written to disk before being uploaded. `.default` instance by default.\n    ///\n    /// - Returns:                   The created `UploadRequest`.\n    open func upload(multipartFormData: @escaping (MultipartFormData) -> Void,\n                     with request: URLRequestConvertible,\n                     usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        let formData = MultipartFormData(fileManager: fileManager)\n        multipartFormData(formData)\n\n        return upload(multipartFormData: formData,\n                      with: request,\n                      usingThreshold: encodingMemoryThreshold,\n                      interceptor: interceptor,\n                      fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` for the prebuilt `MultipartFormData` value using the provided `URLRequest` components\n    /// and `RequestInterceptor`.\n    ///\n    /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\n    /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most\n    /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\n    /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\n    /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\n    /// used for larger payloads such as video content.\n    ///\n    /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\n    /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\n    /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\n    /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\n    /// technique was used.\n    ///\n    /// - Parameters:\n    ///   - multipartFormData:       `MultipartFormData` instance to upload.\n    ///   - url:                     `URLConvertible` value to be used as the `URLRequest`'s `URL`.\n    ///   - encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or\n    ///                              onto disk before being uploaded. `MultipartFormData.encodingMemoryThreshold` by\n    ///                              default.\n    ///   - method:                  `HTTPMethod` for the `URLRequest`. `.post` by default.\n    ///   - headers:                 `HTTPHeaders` value to be added to the `URLRequest`. `nil` by default.\n    ///   - interceptor:             `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager:             `FileManager` to be used if the form data exceeds the memory threshold and is\n    ///                              written to disk before being uploaded. `.default` instance by default.\n    ///\n    /// - Returns:                   The created `UploadRequest`.\n    open func upload(multipartFormData: MultipartFormData,\n                     to url: URLConvertible,\n                     usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,\n                     method: HTTPMethod = .post,\n                     headers: HTTPHeaders? = nil,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        let convertible = ParameterlessRequestConvertible(url: url, method: method, headers: headers)\n\n        let multipartUpload = MultipartUpload(isInBackgroundSession: session.configuration.identifier != nil,\n                                              encodingMemoryThreshold: encodingMemoryThreshold,\n                                              request: convertible,\n                                              multipartFormData: multipartFormData)\n\n        return upload(multipartUpload, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    /// Creates an `UploadRequest` for the prebuilt `MultipartFormData` value using the providing `URLRequestConvertible`\n    /// value and `RequestInterceptor`.\n    ///\n    /// It is important to understand the memory implications of uploading `MultipartFormData`. If the cumulative\n    /// payload is small, encoding the data in-memory and directly uploading to a server is the by far the most\n    /// efficient approach. However, if the payload is too large, encoding the data in-memory could cause your app to\n    /// be terminated. Larger payloads must first be written to disk using input and output streams to keep the memory\n    /// footprint low, then the data can be uploaded as a stream from the resulting file. Streaming from disk MUST be\n    /// used for larger payloads such as video content.\n    ///\n    /// The `encodingMemoryThreshold` parameter allows Alamofire to automatically determine whether to encode in-memory\n    /// or stream from disk. If the content length of the `MultipartFormData` is below the `encodingMemoryThreshold`,\n    /// encoding takes place in-memory. If the content length exceeds the threshold, the data is streamed to disk\n    /// during the encoding process. Then the result is uploaded as data or as a stream depending on which encoding\n    /// technique was used.\n    ///\n    /// - Parameters:\n    ///   - multipartFormData:       `MultipartFormData` instance to upload.\n    ///   - request:                 `URLRequestConvertible` value to be used to create the `URLRequest`.\n    ///   - encodingMemoryThreshold: Byte threshold used to determine whether the form data is encoded into memory or\n    ///                              onto disk before being uploaded. `MultipartFormData.encodingMemoryThreshold` by\n    ///                              default.\n    ///   - interceptor:             `RequestInterceptor` value to be used by the returned `DataRequest`. `nil` by default.\n    ///   - fileManager:             `FileManager` instance to be used by the returned `UploadRequest`. `.default` instance by\n    ///                              default.\n    ///\n    /// - Returns:                   The created `UploadRequest`.\n    open func upload(multipartFormData: MultipartFormData,\n                     with request: URLRequestConvertible,\n                     usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,\n                     interceptor: RequestInterceptor? = nil,\n                     fileManager: FileManager = .default) -> UploadRequest {\n        let multipartUpload = MultipartUpload(isInBackgroundSession: session.configuration.identifier != nil,\n                                              encodingMemoryThreshold: encodingMemoryThreshold,\n                                              request: request,\n                                              multipartFormData: multipartFormData)\n\n        return upload(multipartUpload, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    // MARK: - Internal API\n\n    // MARK: Uploadable\n\n    func upload(_ uploadable: UploadRequest.Uploadable,\n                with convertible: URLRequestConvertible,\n                interceptor: RequestInterceptor?,\n                fileManager: FileManager) -> UploadRequest {\n        let uploadable = Upload(request: convertible, uploadable: uploadable)\n\n        return upload(uploadable, interceptor: interceptor, fileManager: fileManager)\n    }\n\n    func upload(_ upload: UploadConvertible, interceptor: RequestInterceptor?, fileManager: FileManager) -> UploadRequest {\n        let request = UploadRequest(convertible: upload,\n                                    underlyingQueue: rootQueue,\n                                    serializationQueue: serializationQueue,\n                                    eventMonitor: eventMonitor,\n                                    interceptor: interceptor,\n                                    fileManager: fileManager,\n                                    delegate: self)\n\n        perform(request)\n\n        return request\n    }\n\n    // MARK: Perform\n\n    /// Perform `Request`.\n    ///\n    /// - Note: Called during retry.\n    ///\n    /// - Parameter request: The `Request` to perform.\n    func perform(_ request: Request) {\n        switch request {\n        case let r as DataRequest: perform(r)\n        case let r as UploadRequest: perform(r)\n        case let r as DownloadRequest: perform(r)\n        default: fatalError(\"Attempted to perform unsupported Request subclass: \\(type(of: request))\")\n        }\n    }\n\n    func perform(_ request: DataRequest) {\n        requestQueue.async {\n            guard !request.isCancelled else { return }\n\n            self.activeRequests.insert(request)\n\n            self.performSetupOperations(for: request, convertible: request.convertible)\n        }\n    }\n\n    func perform(_ request: UploadRequest) {\n        requestQueue.async {\n            guard !request.isCancelled else { return }\n\n            self.activeRequests.insert(request)\n\n            do {\n                let uploadable = try request.upload.createUploadable()\n                self.rootQueue.async { request.didCreateUploadable(uploadable) }\n\n                self.performSetupOperations(for: request, convertible: request.convertible)\n            } catch {\n                self.rootQueue.async { request.didFailToCreateUploadable(with: error.asAFError(or: .createUploadableFailed(error: error))) }\n            }\n        }\n    }\n\n    func perform(_ request: DownloadRequest) {\n        requestQueue.async {\n            guard !request.isCancelled else { return }\n\n            self.activeRequests.insert(request)\n\n            switch request.downloadable {\n            case let .request(convertible):\n                self.performSetupOperations(for: request, convertible: convertible)\n            case let .resumeData(resumeData):\n                self.rootQueue.async { self.didReceiveResumeData(resumeData, for: request) }\n            }\n        }\n    }\n\n    func performSetupOperations(for request: Request, convertible: URLRequestConvertible) {\n        let initialRequest: URLRequest\n\n        do {\n            initialRequest = try convertible.asURLRequest()\n            try initialRequest.validate()\n        } catch {\n            rootQueue.async { request.didFailToCreateURLRequest(with: error.asAFError(or: .createURLRequestFailed(error: error))) }\n            return\n        }\n\n        rootQueue.async { request.didCreateInitialURLRequest(initialRequest) }\n\n        guard !request.isCancelled else { return }\n\n        guard let adapter = adapter(for: request) else {\n            rootQueue.async { self.didCreateURLRequest(initialRequest, for: request) }\n            return\n        }\n\n        adapter.adapt(initialRequest, for: self) { result in\n            do {\n                let adaptedRequest = try result.get()\n                try adaptedRequest.validate()\n\n                self.rootQueue.async {\n                    request.didAdaptInitialRequest(initialRequest, to: adaptedRequest)\n                    self.didCreateURLRequest(adaptedRequest, for: request)\n                }\n            } catch {\n                self.rootQueue.async { request.didFailToAdaptURLRequest(initialRequest, withError: .requestAdaptationFailed(error: error)) }\n            }\n        }\n    }\n\n    // MARK: - Task Handling\n\n    func didCreateURLRequest(_ urlRequest: URLRequest, for request: Request) {\n        request.didCreateURLRequest(urlRequest)\n\n        guard !request.isCancelled else { return }\n\n        let task = request.task(for: urlRequest, using: session)\n        requestTaskMap[request] = task\n        request.didCreateTask(task)\n\n        updateStatesForTask(task, request: request)\n    }\n\n    func didReceiveResumeData(_ data: Data, for request: DownloadRequest) {\n        guard !request.isCancelled else { return }\n\n        let task = request.task(forResumeData: data, using: session)\n        requestTaskMap[request] = task\n        request.didCreateTask(task)\n\n        updateStatesForTask(task, request: request)\n    }\n\n    func updateStatesForTask(_ task: URLSessionTask, request: Request) {\n        request.withState { state in\n            switch state {\n            case .initialized, .finished:\n                // Do nothing.\n                break\n            case .resumed:\n                task.resume()\n                rootQueue.async { request.didResumeTask(task) }\n            case .suspended:\n                task.suspend()\n                rootQueue.async { request.didSuspendTask(task) }\n            case .cancelled:\n                // Resume to ensure metrics are gathered.\n                task.resume()\n                task.cancel()\n                rootQueue.async { request.didCancelTask(task) }\n            }\n        }\n    }\n\n    // MARK: - Adapters and Retriers\n\n    func adapter(for request: Request) -> RequestAdapter? {\n        if let requestInterceptor = request.interceptor, let sessionInterceptor = interceptor {\n            return Interceptor(adapters: [requestInterceptor, sessionInterceptor])\n        } else {\n            return request.interceptor ?? interceptor\n        }\n    }\n\n    func retrier(for request: Request) -> RequestRetrier? {\n        if let requestInterceptor = request.interceptor, let sessionInterceptor = interceptor {\n            return Interceptor(retriers: [requestInterceptor, sessionInterceptor])\n        } else {\n            return request.interceptor ?? interceptor\n        }\n    }\n\n    // MARK: - Invalidation\n\n    func finishRequestsForDeinit() {\n        requestTaskMap.requests.forEach { $0.finish(error: AFError.sessionDeinitialized) }\n    }\n}\n\n// MARK: - RequestDelegate\n\nextension Session: RequestDelegate {\n    public var sessionConfiguration: URLSessionConfiguration {\n        return session.configuration\n    }\n\n    public var startImmediately: Bool { return startRequestsImmediately }\n\n    public func cleanup(after request: Request) {\n        activeRequests.remove(request)\n    }\n\n    public func retryResult(for request: Request, dueTo error: AFError, completion: @escaping (RetryResult) -> Void) {\n        guard let retrier = retrier(for: request) else {\n            rootQueue.async { completion(.doNotRetry) }\n            return\n        }\n\n        retrier.retry(request, for: self, dueTo: error) { retryResult in\n            self.rootQueue.async {\n                guard let retryResultError = retryResult.error else { completion(retryResult); return }\n\n                let retryError = AFError.requestRetryFailed(retryError: retryResultError, originalError: error)\n                completion(.doNotRetryWithError(retryError))\n            }\n        }\n    }\n\n    public func retryRequest(_ request: Request, withDelay timeDelay: TimeInterval?) {\n        rootQueue.async {\n            let retry: () -> Void = {\n                guard !request.isCancelled else { return }\n\n                request.prepareForRetry()\n                self.perform(request)\n            }\n\n            if let retryDelay = timeDelay {\n                self.rootQueue.after(retryDelay) { retry() }\n            } else {\n                retry()\n            }\n        }\n    }\n}\n\n// MARK: - SessionStateProvider\n\nextension Session: SessionStateProvider {\n    func request(for task: URLSessionTask) -> Request? {\n        return requestTaskMap[task]\n    }\n\n    func didGatherMetricsForTask(_ task: URLSessionTask) {\n        requestTaskMap.disassociateIfNecessaryAfterGatheringMetricsForTask(task)\n    }\n\n    func didCompleteTask(_ task: URLSessionTask) {\n        requestTaskMap.disassociateIfNecessaryAfterCompletingTask(task)\n    }\n\n    func credential(for task: URLSessionTask, in protectionSpace: URLProtectionSpace) -> URLCredential? {\n        return requestTaskMap[task]?.credential ??\n            session.configuration.urlCredentialStorage?.defaultCredential(for: protectionSpace)\n    }\n\n    func cancelRequestsForSessionInvalidation(with error: Error?) {\n        requestTaskMap.requests.forEach { $0.finish(error: AFError.sessionInvalidated(error: error)) }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/SessionDelegate.swift",
    "content": "//\n//  SessionDelegate.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Class which implements the various `URLSessionDelegate` methods to connect various Alamofire features.\nopen class SessionDelegate: NSObject {\n    private let fileManager: FileManager\n\n    weak var stateProvider: SessionStateProvider?\n    var eventMonitor: EventMonitor?\n\n    /// Creates an instance from the given `FileManager`.\n    ///\n    /// - Parameter fileManager: `FileManager` to use for underlying file management, such as moving downloaded files.\n    ///                          `.default` by default.\n    public init(fileManager: FileManager = .default) {\n        self.fileManager = fileManager\n    }\n\n    /// Internal method to find and cast requests while maintaining some integrity checking.\n    ///\n    /// - Parameters:\n    ///   - task: The `URLSessionTask` for which to find the associated `Request`.\n    ///   - type: The `Request` subclass type to cast any `Request` associate with `task`.\n    func request<R: Request>(for task: URLSessionTask, as type: R.Type) -> R? {\n        guard let provider = stateProvider else {\n            assertionFailure(\"StateProvider is nil.\")\n            return nil\n        }\n\n        guard let request = provider.request(for: task) as? R else {\n            fatalError(\"Returned Request is not of expected type: \\(R.self).\")\n        }\n\n        return request\n    }\n}\n\n/// Type which provides various `Session` state values.\nprotocol SessionStateProvider: AnyObject {\n    var serverTrustManager: ServerTrustManager? { get }\n    var redirectHandler: RedirectHandler? { get }\n    var cachedResponseHandler: CachedResponseHandler? { get }\n\n    func request(for task: URLSessionTask) -> Request?\n    func didGatherMetricsForTask(_ task: URLSessionTask)\n    func didCompleteTask(_ task: URLSessionTask)\n    func credential(for task: URLSessionTask, in protectionSpace: URLProtectionSpace) -> URLCredential?\n    func cancelRequestsForSessionInvalidation(with error: Error?)\n}\n\n// MARK: URLSessionDelegate\n\nextension SessionDelegate: URLSessionDelegate {\n    open func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {\n        eventMonitor?.urlSession(session, didBecomeInvalidWithError: error)\n\n        stateProvider?.cancelRequestsForSessionInvalidation(with: error)\n    }\n}\n\n// MARK: URLSessionTaskDelegate\n\nextension SessionDelegate: URLSessionTaskDelegate {\n    /// Result of a `URLAuthenticationChallenge` evaluation.\n    typealias ChallengeEvaluation = (disposition: URLSession.AuthChallengeDisposition, credential: URLCredential?, error: AFError?)\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         didReceive challenge: URLAuthenticationChallenge,\n                         completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {\n        eventMonitor?.urlSession(session, task: task, didReceive: challenge)\n\n        let evaluation: ChallengeEvaluation\n        switch challenge.protectionSpace.authenticationMethod {\n        case NSURLAuthenticationMethodServerTrust:\n            evaluation = attemptServerTrustAuthentication(with: challenge)\n        case NSURLAuthenticationMethodHTTPBasic, NSURLAuthenticationMethodHTTPDigest, NSURLAuthenticationMethodNTLM,\n             NSURLAuthenticationMethodNegotiate, NSURLAuthenticationMethodClientCertificate:\n            evaluation = attemptCredentialAuthentication(for: challenge, belongingTo: task)\n        default:\n            evaluation = (.performDefaultHandling, nil, nil)\n        }\n\n        if let error = evaluation.error {\n            stateProvider?.request(for: task)?.didFailTask(task, earlyWithError: error)\n        }\n\n        completionHandler(evaluation.disposition, evaluation.credential)\n    }\n\n    /// Evaluates the server trust `URLAuthenticationChallenge` received.\n    ///\n    /// - Parameter challenge: The `URLAuthenticationChallenge`.\n    ///\n    /// - Returns:             The `ChallengeEvaluation`.\n    func attemptServerTrustAuthentication(with challenge: URLAuthenticationChallenge) -> ChallengeEvaluation {\n        let host = challenge.protectionSpace.host\n\n        guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust,\n            let trust = challenge.protectionSpace.serverTrust\n        else {\n            return (.performDefaultHandling, nil, nil)\n        }\n\n        do {\n            guard let evaluator = try stateProvider?.serverTrustManager?.serverTrustEvaluator(forHost: host) else {\n                return (.performDefaultHandling, nil, nil)\n            }\n\n            try evaluator.evaluate(trust, forHost: host)\n\n            return (.useCredential, URLCredential(trust: trust), nil)\n        } catch {\n            return (.cancelAuthenticationChallenge, nil, error.asAFError(or: .serverTrustEvaluationFailed(reason: .customEvaluationFailed(error: error))))\n        }\n    }\n\n    /// Evaluates the credential-based authentication `URLAuthenticationChallenge` received for `task`.\n    ///\n    /// - Parameters:\n    ///   - challenge: The `URLAuthenticationChallenge`.\n    ///   - task:      The `URLSessionTask` which received the challenge.\n    ///\n    /// - Returns:     The `ChallengeEvaluation`.\n    func attemptCredentialAuthentication(for challenge: URLAuthenticationChallenge,\n                                         belongingTo task: URLSessionTask) -> ChallengeEvaluation {\n        guard challenge.previousFailureCount == 0 else {\n            return (.rejectProtectionSpace, nil, nil)\n        }\n\n        guard let credential = stateProvider?.credential(for: task, in: challenge.protectionSpace) else {\n            return (.performDefaultHandling, nil, nil)\n        }\n\n        return (.useCredential, credential, nil)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         didSendBodyData bytesSent: Int64,\n                         totalBytesSent: Int64,\n                         totalBytesExpectedToSend: Int64) {\n        eventMonitor?.urlSession(session,\n                                 task: task,\n                                 didSendBodyData: bytesSent,\n                                 totalBytesSent: totalBytesSent,\n                                 totalBytesExpectedToSend: totalBytesExpectedToSend)\n\n        stateProvider?.request(for: task)?.updateUploadProgress(totalBytesSent: totalBytesSent,\n                                                                totalBytesExpectedToSend: totalBytesExpectedToSend)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) {\n        eventMonitor?.urlSession(session, taskNeedsNewBodyStream: task)\n\n        guard let request = request(for: task, as: UploadRequest.self) else {\n            assertionFailure(\"needNewBodyStream did not find UploadRequest.\")\n            completionHandler(nil)\n            return\n        }\n\n        completionHandler(request.inputStream())\n    }\n\n    open func urlSession(_ session: URLSession,\n                         task: URLSessionTask,\n                         willPerformHTTPRedirection response: HTTPURLResponse,\n                         newRequest request: URLRequest,\n                         completionHandler: @escaping (URLRequest?) -> Void) {\n        eventMonitor?.urlSession(session, task: task, willPerformHTTPRedirection: response, newRequest: request)\n\n        if let redirectHandler = stateProvider?.request(for: task)?.redirectHandler ?? stateProvider?.redirectHandler {\n            redirectHandler.task(task, willBeRedirectedTo: request, for: response, completion: completionHandler)\n        } else {\n            completionHandler(request)\n        }\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didFinishCollecting metrics: URLSessionTaskMetrics) {\n        eventMonitor?.urlSession(session, task: task, didFinishCollecting: metrics)\n\n        stateProvider?.request(for: task)?.didGatherMetrics(metrics)\n\n        stateProvider?.didGatherMetricsForTask(task)\n    }\n\n    open func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {\n        eventMonitor?.urlSession(session, task: task, didCompleteWithError: error)\n\n        stateProvider?.request(for: task)?.didCompleteTask(task, with: error.map { $0.asAFError(or: .sessionTaskFailed(error: $0)) })\n\n        stateProvider?.didCompleteTask(task)\n    }\n\n    @available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)\n    open func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {\n        eventMonitor?.urlSession(session, taskIsWaitingForConnectivity: task)\n    }\n}\n\n// MARK: URLSessionDataDelegate\n\nextension SessionDelegate: URLSessionDataDelegate {\n    open func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {\n        eventMonitor?.urlSession(session, dataTask: dataTask, didReceive: data)\n\n        guard let request = request(for: dataTask, as: DataRequest.self) else {\n            assertionFailure(\"dataTask did not find DataRequest.\")\n            return\n        }\n\n        request.didReceive(data: data)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         dataTask: URLSessionDataTask,\n                         willCacheResponse proposedResponse: CachedURLResponse,\n                         completionHandler: @escaping (CachedURLResponse?) -> Void) {\n        eventMonitor?.urlSession(session, dataTask: dataTask, willCacheResponse: proposedResponse)\n\n        if let handler = stateProvider?.request(for: dataTask)?.cachedResponseHandler ?? stateProvider?.cachedResponseHandler {\n            handler.dataTask(dataTask, willCacheResponse: proposedResponse, completion: completionHandler)\n        } else {\n            completionHandler(proposedResponse)\n        }\n    }\n}\n\n// MARK: URLSessionDownloadDelegate\n\nextension SessionDelegate: URLSessionDownloadDelegate {\n    open func urlSession(_ session: URLSession,\n                         downloadTask: URLSessionDownloadTask,\n                         didResumeAtOffset fileOffset: Int64,\n                         expectedTotalBytes: Int64) {\n        eventMonitor?.urlSession(session,\n                                 downloadTask: downloadTask,\n                                 didResumeAtOffset: fileOffset,\n                                 expectedTotalBytes: expectedTotalBytes)\n        guard let downloadRequest = request(for: downloadTask, as: DownloadRequest.self) else {\n            assertionFailure(\"downloadTask did not find DownloadRequest.\")\n            return\n        }\n\n        downloadRequest.updateDownloadProgress(bytesWritten: fileOffset,\n                                               totalBytesExpectedToWrite: expectedTotalBytes)\n    }\n\n    open func urlSession(_ session: URLSession,\n                         downloadTask: URLSessionDownloadTask,\n                         didWriteData bytesWritten: Int64,\n                         totalBytesWritten: Int64,\n                         totalBytesExpectedToWrite: Int64) {\n        eventMonitor?.urlSession(session,\n                                 downloadTask: downloadTask,\n                                 didWriteData: bytesWritten,\n                                 totalBytesWritten: totalBytesWritten,\n                                 totalBytesExpectedToWrite: totalBytesExpectedToWrite)\n        guard let downloadRequest = request(for: downloadTask, as: DownloadRequest.self) else {\n            assertionFailure(\"downloadTask did not find DownloadRequest.\")\n            return\n        }\n\n        downloadRequest.updateDownloadProgress(bytesWritten: bytesWritten,\n                                               totalBytesExpectedToWrite: totalBytesExpectedToWrite)\n    }\n\n    open func urlSession(_ session: URLSession, downloadTask: URLSessionDownloadTask, didFinishDownloadingTo location: URL) {\n        eventMonitor?.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location)\n\n        guard let request = request(for: downloadTask, as: DownloadRequest.self) else {\n            assertionFailure(\"downloadTask did not find DownloadRequest.\")\n            return\n        }\n\n        guard let response = request.response else {\n            fatalError(\"URLSessionDownloadTask finished downloading with no response.\")\n        }\n\n        let (destination, options) = (request.destination)(location, response)\n\n        eventMonitor?.request(request, didCreateDestinationURL: destination)\n\n        do {\n            if options.contains(.removePreviousFile), fileManager.fileExists(atPath: destination.path) {\n                try fileManager.removeItem(at: destination)\n            }\n\n            if options.contains(.createIntermediateDirectories) {\n                let directory = destination.deletingLastPathComponent()\n                try fileManager.createDirectory(at: directory, withIntermediateDirectories: true)\n            }\n\n            try fileManager.moveItem(at: location, to: destination)\n\n            request.didFinishDownloading(using: downloadTask, with: .success(destination))\n        } catch {\n            request.didFinishDownloading(using: downloadTask, with: .failure(.downloadedFileMoveFailed(error: error, source: location, destination: destination)))\n        }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift",
    "content": "//\n//  URLConvertible+URLRequestConvertible.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// Types adopting the `URLConvertible` protocol can be used to construct `URL`s, which can then be used to construct\n/// `URLRequests`.\npublic protocol URLConvertible {\n    /// Returns a `URL` from the conforming instance or throws.\n    ///\n    /// - Returns: The `URL` created from the instance.\n    /// - Throws:  Any error thrown while creating the `URL`.\n    func asURL() throws -> URL\n}\n\nextension String: URLConvertible {\n    /// Returns a `URL` if `self` can be used to initialize a `URL` instance, otherwise throws.\n    ///\n    /// - Returns: The `URL` initialized with `self`.\n    /// - Throws:  An `AFError.invalidURL` instance.\n    public func asURL() throws -> URL {\n        guard let url = URL(string: self) else { throw AFError.invalidURL(url: self) }\n\n        return url\n    }\n}\n\nextension URL: URLConvertible {\n    /// Returns `self`.\n    public func asURL() throws -> URL { return self }\n}\n\nextension URLComponents: URLConvertible {\n    /// Returns a `URL` if the `self`'s `url` is not nil, otherwise throws.\n    ///\n    /// - Returns: The `URL` from the `url` property.\n    /// - Throws:  An `AFError.invalidURL` instance.\n    public func asURL() throws -> URL {\n        guard let url = url else { throw AFError.invalidURL(url: self) }\n\n        return url\n    }\n}\n\n// MARK: -\n\n/// Types adopting the `URLRequestConvertible` protocol can be used to safely construct `URLRequest`s.\npublic protocol URLRequestConvertible {\n    /// Returns a `URLRequest` or throws if an `Error` was encountered.\n    ///\n    /// - Returns: A `URLRequest`.\n    /// - Throws:  Any error thrown while constructing the `URLRequest`.\n    func asURLRequest() throws -> URLRequest\n}\n\nextension URLRequestConvertible {\n    /// The `URLRequest` returned by discarding any `Error` encountered.\n    public var urlRequest: URLRequest? { return try? asURLRequest() }\n}\n\nextension URLRequest: URLRequestConvertible {\n    /// Returns `self`.\n    public func asURLRequest() throws -> URLRequest { return self }\n}\n\n// MARK: -\n\nextension URLRequest {\n    /// Creates an instance with the specified `url`, `method`, and `headers`.\n    ///\n    /// - Parameters:\n    ///   - url:     The `URLConvertible` value.\n    ///   - method:  The `HTTPMethod`.\n    ///   - headers: The `HTTPHeaders`, `nil` by default.\n    /// - Throws:    Any error thrown while converting the `URLConvertible` to a `URL`.\n    public init(url: URLConvertible, method: HTTPMethod, headers: HTTPHeaders? = nil) throws {\n        let url = try url.asURL()\n\n        self.init(url: url)\n\n        httpMethod = method.rawValue\n        allHTTPHeaderFields = headers?.dictionary\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/URLEncodedFormEncoder.swift",
    "content": "//\n//  URLEncodedFormEncoder.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\n/// An object that encodes instances into URL-encoded query strings.\n///\n/// There is no published specification for how to encode collection types. By default, the convention of appending\n/// `[]` to the key for array values (`foo[]=1&foo[]=2`), and appending the key surrounded by square brackets for\n/// nested dictionary values (`foo[bar]=baz`) is used. Optionally, `ArrayEncoding` can be used to omit the\n/// square brackets appended to array keys.\n///\n/// `BoolEncoding` can be used to configure how `Bool` values are encoded. The default behavior is to encode\n/// `true` as 1 and `false` as 0.\n///\n/// `DateEncoding` can be used to configure how `Date` values are encoded. By default, the `.deferredToDate`\n/// strategy is used, which formats dates from their structure.\n///\n/// `SpaceEncoding` can be used to configure how spaces are encoded. Modern encodings use percent replacement (`%20`),\n/// while older encodings may expect spaces to be replaced with `+`.\n///\n/// This type is largely based on Vapor's [`url-encoded-form`](https://github.com/vapor/url-encoded-form) project.\npublic final class URLEncodedFormEncoder {\n    /// Encoding to use for `Array` values.\n    public enum ArrayEncoding {\n        /// An empty set of square brackets (\"[]\") are appended to the key for every value. This is the default encoding.\n        case brackets\n        /// No brackets are appended to the key and the key is encoded as is.\n        case noBrackets\n\n        /// Encodes the key according to the encoding.\n        ///\n        /// - Parameter key: The `key` to encode.\n        /// - Returns:       The encoded key.\n        func encode(_ key: String) -> String {\n            switch self {\n            case .brackets: return \"\\(key)[]\"\n            case .noBrackets: return key\n            }\n        }\n    }\n\n    /// Encoding to use for `Bool` values.\n    public enum BoolEncoding {\n        /// Encodes `true` as `1`, `false` as `0`.\n        case numeric\n        /// Encodes `true` as \"true\", `false` as \"false\". This is the default encoding.\n        case literal\n\n        /// Encodes the given `Bool` as a `String`.\n        ///\n        /// - Parameter value: The `Bool` to encode.\n        ///\n        /// - Returns:         The encoded `String`.\n        func encode(_ value: Bool) -> String {\n            switch self {\n            case .numeric: return value ? \"1\" : \"0\"\n            case .literal: return value ? \"true\" : \"false\"\n            }\n        }\n    }\n\n    /// Encoding to use for `Data` values.\n    public enum DataEncoding {\n        /// Defers encoding to the `Data` type.\n        case deferredToData\n        /// Encodes `Data` as a Base64-encoded string. This is the default encoding.\n        case base64\n        /// Encode the `Data` as a custom value encoded by the given closure.\n        case custom((Data) throws -> String)\n\n        /// Encodes `Data` according to the encoding.\n        ///\n        /// - Parameter data: The `Data` to encode.\n        ///\n        /// - Returns:        The encoded `String`, or `nil` if the `Data` should be encoded according to its\n        ///                   `Encodable` implementation.\n        func encode(_ data: Data) throws -> String? {\n            switch self {\n            case .deferredToData: return nil\n            case .base64: return data.base64EncodedString()\n            case let .custom(encoding): return try encoding(data)\n            }\n        }\n    }\n\n    /// Encoding to use for `Date` values.\n    public enum DateEncoding {\n        /// ISO8601 and RFC3339 formatter.\n        private static let iso8601Formatter: ISO8601DateFormatter = {\n            let formatter = ISO8601DateFormatter()\n            formatter.formatOptions = .withInternetDateTime\n            return formatter\n        }()\n\n        /// Defers encoding to the `Date` type. This is the default encoding.\n        case deferredToDate\n        /// Encodes `Date`s as seconds since midnight UTC on January 1, 1970.\n        case secondsSince1970\n        /// Encodes `Date`s as milliseconds since midnight UTC on January 1, 1970.\n        case millisecondsSince1970\n        /// Encodes `Date`s according to the ISO8601 and RFC3339 standards.\n        case iso8601\n        /// Encodes `Date`s using the given `DateFormatter`.\n        case formatted(DateFormatter)\n        /// Encodes `Date`s using the given closure.\n        case custom((Date) throws -> String)\n\n        /// Encodes the date according to the encoding.\n        ///\n        /// - Parameter date: The `Date` to encode.\n        ///\n        /// - Returns:        The encoded `String`, or `nil` if the `Date` should be encoded according to its\n        ///                   `Encodable` implementation.\n        func encode(_ date: Date) throws -> String? {\n            switch self {\n            case .deferredToDate:\n                return nil\n            case .secondsSince1970:\n                return String(date.timeIntervalSince1970)\n            case .millisecondsSince1970:\n                return String(date.timeIntervalSince1970 * 1000.0)\n            case .iso8601:\n                return DateEncoding.iso8601Formatter.string(from: date)\n            case let .formatted(formatter):\n                return formatter.string(from: date)\n            case let .custom(closure):\n                return try closure(date)\n            }\n        }\n    }\n\n    /// Encoding to use for keys.\n    ///\n    /// This type is derived from [`JSONEncoder`'s `KeyEncodingStrategy`](https://github.com/apple/swift/blob/6aa313b8dd5f05135f7f878eccc1db6f9fbe34ff/stdlib/public/Darwin/Foundation/JSONEncoder.swift#L128)\n    /// and [`XMLEncoder`s `KeyEncodingStrategy`](https://github.com/MaxDesiatov/XMLCoder/blob/master/Sources/XMLCoder/Encoder/XMLEncoder.swift#L102).\n    public enum KeyEncoding {\n        /// Use the keys specified by each type. This is the default encoding.\n        case useDefaultKeys\n        /// Convert from \"camelCaseKeys\" to \"snake_case_keys\" before writing a key.\n        ///\n        /// Capital characters are determined by testing membership in\n        /// `CharacterSet.uppercaseLetters` and `CharacterSet.lowercaseLetters`\n        /// (Unicode General Categories Lu and Lt).\n        /// The conversion to lower case uses `Locale.system`, also known as\n        /// the ICU \"root\" locale. This means the result is consistent\n        /// regardless of the current user's locale and language preferences.\n        ///\n        /// Converting from camel case to snake case:\n        /// 1. Splits words at the boundary of lower-case to upper-case\n        /// 2. Inserts `_` between words\n        /// 3. Lowercases the entire string\n        /// 4. Preserves starting and ending `_`.\n        ///\n        /// For example, `oneTwoThree` becomes `one_two_three`. `_oneTwoThree_` becomes `_one_two_three_`.\n        ///\n        /// - Note: Using a key encoding strategy has a nominal performance cost, as each string key has to be converted.\n        case convertToSnakeCase\n        /// Same as convertToSnakeCase, but using `-` instead of `_`.\n        /// For example `oneTwoThree` becomes `one-two-three`.\n        case convertToKebabCase\n        /// Capitalize the first letter only.\n        /// For example `oneTwoThree` becomes  `OneTwoThree`.\n        case capitalized\n        /// Uppercase all letters.\n        /// For example `oneTwoThree` becomes  `ONETWOTHREE`.\n        case uppercased\n        /// Lowercase all letters.\n        /// For example `oneTwoThree` becomes  `onetwothree`.\n        case lowercased\n        /// A custom encoding using the provided closure.\n        case custom((String) -> String)\n\n        func encode(_ key: String) -> String {\n            switch self {\n            case .useDefaultKeys: return key\n            case .convertToSnakeCase: return convertToSnakeCase(key)\n            case .convertToKebabCase: return convertToKebabCase(key)\n            case .capitalized: return String(key.prefix(1).uppercased() + key.dropFirst())\n            case .uppercased: return key.uppercased()\n            case .lowercased: return key.lowercased()\n            case let .custom(encoding): return encoding(key)\n            }\n        }\n\n        private func convertToSnakeCase(_ key: String) -> String {\n            return convert(key, usingSeparator: \"_\")\n        }\n\n        private func convertToKebabCase(_ key: String) -> String {\n            return convert(key, usingSeparator: \"-\")\n        }\n\n        private func convert(_ key: String, usingSeparator separator: String) -> String {\n            guard !key.isEmpty else { return key }\n\n            var words: [Range<String.Index>] = []\n            // The general idea of this algorithm is to split words on\n            // transition from lower to upper case, then on transition of >1\n            // upper case characters to lowercase\n            //\n            // myProperty -> my_property\n            // myURLProperty -> my_url_property\n            //\n            // It is assumed, per Swift naming conventions, that the first character of the key is lowercase.\n            var wordStart = key.startIndex\n            var searchRange = key.index(after: wordStart)..<key.endIndex\n\n            // Find next uppercase character\n            while let upperCaseRange = key.rangeOfCharacter(from: CharacterSet.uppercaseLetters, options: [], range: searchRange) {\n                let untilUpperCase = wordStart..<upperCaseRange.lowerBound\n                words.append(untilUpperCase)\n\n                // Find next lowercase character\n                searchRange = upperCaseRange.lowerBound..<searchRange.upperBound\n                guard let lowerCaseRange = key.rangeOfCharacter(from: CharacterSet.lowercaseLetters, options: [], range: searchRange) else {\n                    // There are no more lower case letters. Just end here.\n                    wordStart = searchRange.lowerBound\n                    break\n                }\n\n                // Is the next lowercase letter more than 1 after the uppercase?\n                // If so, we encountered a group of uppercase letters that we\n                // should treat as its own word\n                let nextCharacterAfterCapital = key.index(after: upperCaseRange.lowerBound)\n                if lowerCaseRange.lowerBound == nextCharacterAfterCapital {\n                    // The next character after capital is a lower case character and therefore not a word boundary.\n                    // Continue searching for the next upper case for the boundary.\n                    wordStart = upperCaseRange.lowerBound\n                } else {\n                    // There was a range of >1 capital letters. Turn those into a word, stopping at the capital before the lower case character.\n                    let beforeLowerIndex = key.index(before: lowerCaseRange.lowerBound)\n                    words.append(upperCaseRange.lowerBound..<beforeLowerIndex)\n\n                    // Next word starts at the capital before the lowercase we just found\n                    wordStart = beforeLowerIndex\n                }\n                searchRange = lowerCaseRange.upperBound..<searchRange.upperBound\n            }\n            words.append(wordStart..<searchRange.upperBound)\n            let result = words.map { range in\n                key[range].lowercased()\n            }.joined(separator: separator)\n\n            return result\n        }\n    }\n\n    /// Encoding to use for spaces.\n    public enum SpaceEncoding {\n        /// Encodes spaces according to normal percent escaping rules (%20).\n        case percentEscaped\n        /// Encodes spaces as `+`,\n        case plusReplaced\n\n        /// Encodes the string according to the encoding.\n        ///\n        /// - Parameter string: The `String` to encode.\n        ///\n        /// - Returns:          The encoded `String`.\n        func encode(_ string: String) -> String {\n            switch self {\n            case .percentEscaped: return string.replacingOccurrences(of: \" \", with: \"%20\")\n            case .plusReplaced: return string.replacingOccurrences(of: \" \", with: \"+\")\n            }\n        }\n    }\n\n    /// `URLEncodedFormEncoder` error.\n    public enum Error: Swift.Error {\n        /// An invalid root object was created by the encoder. Only keyed values are valid.\n        case invalidRootObject(String)\n\n        var localizedDescription: String {\n            switch self {\n            case let .invalidRootObject(object):\n                return \"URLEncodedFormEncoder requires keyed root object. Received \\(object) instead.\"\n            }\n        }\n    }\n\n    /// Whether or not to sort the encoded key value pairs.\n    ///\n    /// - Note: This setting ensures a consistent ordering for all encodings of the same parameters. When set to `false`,\n    ///         encoded `Dictionary` values may have a different encoded order each time they're encoded due to\n    ///       ` Dictionary`'s random storage order, but `Encodable` types will maintain their encoded order.\n    public let alphabetizeKeyValuePairs: Bool\n    /// The `ArrayEncoding` to use.\n    public let arrayEncoding: ArrayEncoding\n    /// The `BoolEncoding` to use.\n    public let boolEncoding: BoolEncoding\n    /// THe `DataEncoding` to use.\n    public let dataEncoding: DataEncoding\n    /// The `DateEncoding` to use.\n    public let dateEncoding: DateEncoding\n    /// The `KeyEncoding` to use.\n    public let keyEncoding: KeyEncoding\n    /// The `SpaceEncoding` to use.\n    public let spaceEncoding: SpaceEncoding\n    /// The `CharacterSet` of allowed (non-escaped) characters.\n    public var allowedCharacters: CharacterSet\n\n    /// Creates an instance from the supplied parameters.\n    ///\n    /// - Parameters:\n    ///   - alphabetizeKeyValuePairs: Whether or not to sort the encoded key value pairs. `true` by default.\n    ///   - arrayEncoding:            The `ArrayEncoding` to use. `.brackets` by default.\n    ///   - boolEncoding:             The `BoolEncoding` to use. `.numeric` by default.\n    ///   - dataEncoding:             The `DataEncoding` to use. `.base64` by default.\n    ///   - dateEncoding:             The `DateEncoding` to use. `.deferredToDate` by default.\n    ///   - keyEncoding:              The `KeyEncoding` to use. `.useDefaultKeys` by default.\n    ///   - spaceEncoding:            The `SpaceEncoding` to use. `.percentEscaped` by default.\n    ///   - allowedCharacters:        The `CharacterSet` of allowed (non-escaped) characters. `.afURLQueryAllowed` by\n    ///                               default.\n    public init(alphabetizeKeyValuePairs: Bool = true,\n                arrayEncoding: ArrayEncoding = .brackets,\n                boolEncoding: BoolEncoding = .numeric,\n                dataEncoding: DataEncoding = .base64,\n                dateEncoding: DateEncoding = .deferredToDate,\n                keyEncoding: KeyEncoding = .useDefaultKeys,\n                spaceEncoding: SpaceEncoding = .percentEscaped,\n                allowedCharacters: CharacterSet = .afURLQueryAllowed) {\n        self.alphabetizeKeyValuePairs = alphabetizeKeyValuePairs\n        self.arrayEncoding = arrayEncoding\n        self.boolEncoding = boolEncoding\n        self.dataEncoding = dataEncoding\n        self.dateEncoding = dateEncoding\n        self.keyEncoding = keyEncoding\n        self.spaceEncoding = spaceEncoding\n        self.allowedCharacters = allowedCharacters\n    }\n\n    func encode(_ value: Encodable) throws -> URLEncodedFormComponent {\n        let context = URLEncodedFormContext(.object([]))\n        let encoder = _URLEncodedFormEncoder(context: context,\n                                             boolEncoding: boolEncoding,\n                                             dataEncoding: dataEncoding,\n                                             dateEncoding: dateEncoding)\n        try value.encode(to: encoder)\n\n        return context.component\n    }\n\n    /// Encodes the `value` as a URL form encoded `String`.\n    ///\n    /// - Parameter value: The `Encodable` value.`\n    ///\n    /// - Returns:         The encoded `String`.\n    /// - Throws:          An `Error` or `EncodingError` instance if encoding fails.\n    public func encode(_ value: Encodable) throws -> String {\n        let component: URLEncodedFormComponent = try encode(value)\n\n        guard case let .object(object) = component else {\n            throw Error.invalidRootObject(\"\\(component)\")\n        }\n\n        let serializer = URLEncodedFormSerializer(alphabetizeKeyValuePairs: alphabetizeKeyValuePairs,\n                                                  arrayEncoding: arrayEncoding,\n                                                  keyEncoding: keyEncoding,\n                                                  spaceEncoding: spaceEncoding,\n                                                  allowedCharacters: allowedCharacters)\n        let query = serializer.serialize(object)\n\n        return query\n    }\n\n    /// Encodes the value as `Data`. This is performed by first creating an encoded `String` and then returning the\n    /// `.utf8` data.\n    ///\n    /// - Parameter value: The `Encodable` value.\n    ///\n    /// - Returns:         The encoded `Data`.\n    ///\n    /// - Throws:          An `Error` or `EncodingError` instance if encoding fails.\n    public func encode(_ value: Encodable) throws -> Data {\n        let string: String = try encode(value)\n\n        return Data(string.utf8)\n    }\n}\n\nfinal class _URLEncodedFormEncoder {\n    var codingPath: [CodingKey]\n    // Returns an empty dictionary, as this encoder doesn't support userInfo.\n    var userInfo: [CodingUserInfoKey: Any] { return [:] }\n\n    let context: URLEncodedFormContext\n\n    private let boolEncoding: URLEncodedFormEncoder.BoolEncoding\n    private let dataEncoding: URLEncodedFormEncoder.DataEncoding\n    private let dateEncoding: URLEncodedFormEncoder.DateEncoding\n\n    init(context: URLEncodedFormContext,\n         codingPath: [CodingKey] = [],\n         boolEncoding: URLEncodedFormEncoder.BoolEncoding,\n         dataEncoding: URLEncodedFormEncoder.DataEncoding,\n         dateEncoding: URLEncodedFormEncoder.DateEncoding) {\n        self.context = context\n        self.codingPath = codingPath\n        self.boolEncoding = boolEncoding\n        self.dataEncoding = dataEncoding\n        self.dateEncoding = dateEncoding\n    }\n}\n\nextension _URLEncodedFormEncoder: Encoder {\n    func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key: CodingKey {\n        let container = _URLEncodedFormEncoder.KeyedContainer<Key>(context: context,\n                                                                   codingPath: codingPath,\n                                                                   boolEncoding: boolEncoding,\n                                                                   dataEncoding: dataEncoding,\n                                                                   dateEncoding: dateEncoding)\n        return KeyedEncodingContainer(container)\n    }\n\n    func unkeyedContainer() -> UnkeyedEncodingContainer {\n        return _URLEncodedFormEncoder.UnkeyedContainer(context: context,\n                                                       codingPath: codingPath,\n                                                       boolEncoding: boolEncoding,\n                                                       dataEncoding: dataEncoding,\n                                                       dateEncoding: dateEncoding)\n    }\n\n    func singleValueContainer() -> SingleValueEncodingContainer {\n        return _URLEncodedFormEncoder.SingleValueContainer(context: context,\n                                                           codingPath: codingPath,\n                                                           boolEncoding: boolEncoding,\n                                                           dataEncoding: dataEncoding,\n                                                           dateEncoding: dateEncoding)\n    }\n}\n\nfinal class URLEncodedFormContext {\n    var component: URLEncodedFormComponent\n\n    init(_ component: URLEncodedFormComponent) {\n        self.component = component\n    }\n}\n\nenum URLEncodedFormComponent {\n    typealias Object = [(key: String, value: URLEncodedFormComponent)]\n\n    case string(String)\n    case array([URLEncodedFormComponent])\n    case object(Object)\n\n    /// Converts self to an `[URLEncodedFormData]` or returns `nil` if not convertible.\n    var array: [URLEncodedFormComponent]? {\n        switch self {\n        case let .array(array): return array\n        default: return nil\n        }\n    }\n\n    /// Converts self to an `Object` or returns `nil` if not convertible.\n    var object: Object? {\n        switch self {\n        case let .object(object): return object\n        default: return nil\n        }\n    }\n\n    /// Sets self to the supplied value at a given path.\n    ///\n    ///     data.set(to: \"hello\", at: [\"path\", \"to\", \"value\"])\n    ///\n    /// - parameters:\n    ///     - value: Value of `Self` to set at the supplied path.\n    ///     - path: `CodingKey` path to update with the supplied value.\n    public mutating func set(to value: URLEncodedFormComponent, at path: [CodingKey]) {\n        set(&self, to: value, at: path)\n    }\n\n    /// Recursive backing method to `set(to:at:)`.\n    private func set(_ context: inout URLEncodedFormComponent, to value: URLEncodedFormComponent, at path: [CodingKey]) {\n        guard path.count >= 1 else {\n            context = value\n            return\n        }\n\n        let end = path[0]\n        var child: URLEncodedFormComponent\n        switch path.count {\n        case 1:\n            child = value\n        case 2...:\n            if let index = end.intValue {\n                let array = context.array ?? []\n                if array.count > index {\n                    child = array[index]\n                } else {\n                    child = .array([])\n                }\n                set(&child, to: value, at: Array(path[1...]))\n            } else {\n                child = context.object?.first { $0.key == end.stringValue }?.value ?? .object(.init())\n                set(&child, to: value, at: Array(path[1...]))\n            }\n        default: fatalError(\"Unreachable\")\n        }\n\n        if let index = end.intValue {\n            if var array = context.array {\n                if array.count > index {\n                    array[index] = child\n                } else {\n                    array.append(child)\n                }\n                context = .array(array)\n            } else {\n                context = .array([child])\n            }\n        } else {\n            if var object = context.object {\n                if let index = object.firstIndex(where: { $0.key == end.stringValue }) {\n                    object[index] = (key: end.stringValue, value: child)\n                } else {\n                    object.append((key: end.stringValue, value: child))\n                }\n                context = .object(object)\n            } else {\n                context = .object([(key: end.stringValue, value: child)])\n            }\n        }\n    }\n}\n\nstruct AnyCodingKey: CodingKey, Hashable {\n    let stringValue: String\n    let intValue: Int?\n\n    init?(stringValue: String) {\n        self.stringValue = stringValue\n        intValue = nil\n    }\n\n    init?(intValue: Int) {\n        stringValue = \"\\(intValue)\"\n        self.intValue = intValue\n    }\n\n    init<Key>(_ base: Key) where Key: CodingKey {\n        if let intValue = base.intValue {\n            self.init(intValue: intValue)!\n        } else {\n            self.init(stringValue: base.stringValue)!\n        }\n    }\n}\n\nextension _URLEncodedFormEncoder {\n    final class KeyedContainer<Key> where Key: CodingKey {\n        var codingPath: [CodingKey]\n\n        private let context: URLEncodedFormContext\n        private let boolEncoding: URLEncodedFormEncoder.BoolEncoding\n        private let dataEncoding: URLEncodedFormEncoder.DataEncoding\n        private let dateEncoding: URLEncodedFormEncoder.DateEncoding\n\n        init(context: URLEncodedFormContext,\n             codingPath: [CodingKey],\n             boolEncoding: URLEncodedFormEncoder.BoolEncoding,\n             dataEncoding: URLEncodedFormEncoder.DataEncoding,\n             dateEncoding: URLEncodedFormEncoder.DateEncoding) {\n            self.context = context\n            self.codingPath = codingPath\n            self.boolEncoding = boolEncoding\n            self.dataEncoding = dataEncoding\n            self.dateEncoding = dateEncoding\n        }\n\n        private func nestedCodingPath(for key: CodingKey) -> [CodingKey] {\n            return codingPath + [key]\n        }\n    }\n}\n\nextension _URLEncodedFormEncoder.KeyedContainer: KeyedEncodingContainerProtocol {\n    func encodeNil(forKey key: Key) throws {\n        let context = EncodingError.Context(codingPath: codingPath,\n                                            debugDescription: \"URLEncodedFormEncoder cannot encode nil values.\")\n        throw EncodingError.invalidValue(\"\\(key): nil\", context)\n    }\n\n    func encode<T>(_ value: T, forKey key: Key) throws where T: Encodable {\n        var container = nestedSingleValueEncoder(for: key)\n        try container.encode(value)\n    }\n\n    func nestedSingleValueEncoder(for key: Key) -> SingleValueEncodingContainer {\n        let container = _URLEncodedFormEncoder.SingleValueContainer(context: context,\n                                                                    codingPath: nestedCodingPath(for: key),\n                                                                    boolEncoding: boolEncoding,\n                                                                    dataEncoding: dataEncoding,\n                                                                    dateEncoding: dateEncoding)\n\n        return container\n    }\n\n    func nestedUnkeyedContainer(forKey key: Key) -> UnkeyedEncodingContainer {\n        let container = _URLEncodedFormEncoder.UnkeyedContainer(context: context,\n                                                                codingPath: nestedCodingPath(for: key),\n                                                                boolEncoding: boolEncoding,\n                                                                dataEncoding: dataEncoding,\n                                                                dateEncoding: dateEncoding)\n\n        return container\n    }\n\n    func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: Key) -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey {\n        let container = _URLEncodedFormEncoder.KeyedContainer<NestedKey>(context: context,\n                                                                         codingPath: nestedCodingPath(for: key),\n                                                                         boolEncoding: boolEncoding,\n                                                                         dataEncoding: dataEncoding,\n                                                                         dateEncoding: dateEncoding)\n\n        return KeyedEncodingContainer(container)\n    }\n\n    func superEncoder() -> Encoder {\n        return _URLEncodedFormEncoder(context: context,\n                                      codingPath: codingPath,\n                                      boolEncoding: boolEncoding,\n                                      dataEncoding: dataEncoding,\n                                      dateEncoding: dateEncoding)\n    }\n\n    func superEncoder(forKey key: Key) -> Encoder {\n        return _URLEncodedFormEncoder(context: context,\n                                      codingPath: nestedCodingPath(for: key),\n                                      boolEncoding: boolEncoding,\n                                      dataEncoding: dataEncoding,\n                                      dateEncoding: dateEncoding)\n    }\n}\n\nextension _URLEncodedFormEncoder {\n    final class SingleValueContainer {\n        var codingPath: [CodingKey]\n\n        private var canEncodeNewValue = true\n\n        private let context: URLEncodedFormContext\n        private let boolEncoding: URLEncodedFormEncoder.BoolEncoding\n        private let dataEncoding: URLEncodedFormEncoder.DataEncoding\n        private let dateEncoding: URLEncodedFormEncoder.DateEncoding\n\n        init(context: URLEncodedFormContext,\n             codingPath: [CodingKey],\n             boolEncoding: URLEncodedFormEncoder.BoolEncoding,\n             dataEncoding: URLEncodedFormEncoder.DataEncoding,\n             dateEncoding: URLEncodedFormEncoder.DateEncoding) {\n            self.context = context\n            self.codingPath = codingPath\n            self.boolEncoding = boolEncoding\n            self.dataEncoding = dataEncoding\n            self.dateEncoding = dateEncoding\n        }\n\n        private func checkCanEncode(value: Any?) throws {\n            guard canEncodeNewValue else {\n                let context = EncodingError.Context(codingPath: codingPath,\n                                                    debugDescription: \"Attempt to encode value through single value container when previously value already encoded.\")\n                throw EncodingError.invalidValue(value as Any, context)\n            }\n        }\n    }\n}\n\nextension _URLEncodedFormEncoder.SingleValueContainer: SingleValueEncodingContainer {\n    func encodeNil() throws {\n        try checkCanEncode(value: nil)\n        defer { canEncodeNewValue = false }\n\n        let context = EncodingError.Context(codingPath: codingPath,\n                                            debugDescription: \"URLEncodedFormEncoder cannot encode nil values.\")\n        throw EncodingError.invalidValue(\"nil\", context)\n    }\n\n    func encode(_ value: Bool) throws {\n        try encode(value, as: String(boolEncoding.encode(value)))\n    }\n\n    func encode(_ value: String) throws {\n        try encode(value, as: value)\n    }\n\n    func encode(_ value: Double) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Float) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Int) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Int8) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Int16) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Int32) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: Int64) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: UInt) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: UInt8) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: UInt16) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: UInt32) throws {\n        try encode(value, as: String(value))\n    }\n\n    func encode(_ value: UInt64) throws {\n        try encode(value, as: String(value))\n    }\n\n    private func encode<T>(_ value: T, as string: String) throws where T: Encodable {\n        try checkCanEncode(value: value)\n        defer { canEncodeNewValue = false }\n\n        context.component.set(to: .string(string), at: codingPath)\n    }\n\n    func encode<T>(_ value: T) throws where T: Encodable {\n        switch value {\n        case let date as Date:\n            guard let string = try dateEncoding.encode(date) else {\n                try attemptToEncode(value)\n                return\n            }\n\n            try encode(value, as: string)\n        case let data as Data:\n            guard let string = try dataEncoding.encode(data) else {\n                try attemptToEncode(value)\n                return\n            }\n\n            try encode(value, as: string)\n        default:\n            try attemptToEncode(value)\n        }\n    }\n\n    private func attemptToEncode<T>(_ value: T) throws where T: Encodable {\n        try checkCanEncode(value: value)\n        defer { canEncodeNewValue = false }\n\n        let encoder = _URLEncodedFormEncoder(context: context,\n                                             codingPath: codingPath,\n                                             boolEncoding: boolEncoding,\n                                             dataEncoding: dataEncoding,\n                                             dateEncoding: dateEncoding)\n        try value.encode(to: encoder)\n    }\n}\n\nextension _URLEncodedFormEncoder {\n    final class UnkeyedContainer {\n        var codingPath: [CodingKey]\n\n        var count = 0\n        var nestedCodingPath: [CodingKey] {\n            return codingPath + [AnyCodingKey(intValue: count)!]\n        }\n\n        private let context: URLEncodedFormContext\n        private let boolEncoding: URLEncodedFormEncoder.BoolEncoding\n        private let dataEncoding: URLEncodedFormEncoder.DataEncoding\n        private let dateEncoding: URLEncodedFormEncoder.DateEncoding\n\n        init(context: URLEncodedFormContext,\n             codingPath: [CodingKey],\n             boolEncoding: URLEncodedFormEncoder.BoolEncoding,\n             dataEncoding: URLEncodedFormEncoder.DataEncoding,\n             dateEncoding: URLEncodedFormEncoder.DateEncoding) {\n            self.context = context\n            self.codingPath = codingPath\n            self.boolEncoding = boolEncoding\n            self.dataEncoding = dataEncoding\n            self.dateEncoding = dateEncoding\n        }\n    }\n}\n\nextension _URLEncodedFormEncoder.UnkeyedContainer: UnkeyedEncodingContainer {\n    func encodeNil() throws {\n        let context = EncodingError.Context(codingPath: codingPath,\n                                            debugDescription: \"URLEncodedFormEncoder cannot encode nil values.\")\n        throw EncodingError.invalidValue(\"nil\", context)\n    }\n\n    func encode<T>(_ value: T) throws where T: Encodable {\n        var container = nestedSingleValueContainer()\n        try container.encode(value)\n    }\n\n    func nestedSingleValueContainer() -> SingleValueEncodingContainer {\n        defer { count += 1 }\n\n        return _URLEncodedFormEncoder.SingleValueContainer(context: context,\n                                                           codingPath: nestedCodingPath,\n                                                           boolEncoding: boolEncoding,\n                                                           dataEncoding: dataEncoding,\n                                                           dateEncoding: dateEncoding)\n    }\n\n    func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey {\n        defer { count += 1 }\n        let container = _URLEncodedFormEncoder.KeyedContainer<NestedKey>(context: context,\n                                                                         codingPath: nestedCodingPath,\n                                                                         boolEncoding: boolEncoding,\n                                                                         dataEncoding: dataEncoding,\n                                                                         dateEncoding: dateEncoding)\n\n        return KeyedEncodingContainer(container)\n    }\n\n    func nestedUnkeyedContainer() -> UnkeyedEncodingContainer {\n        defer { count += 1 }\n\n        return _URLEncodedFormEncoder.UnkeyedContainer(context: context,\n                                                       codingPath: nestedCodingPath,\n                                                       boolEncoding: boolEncoding,\n                                                       dataEncoding: dataEncoding,\n                                                       dateEncoding: dateEncoding)\n    }\n\n    func superEncoder() -> Encoder {\n        defer { count += 1 }\n\n        return _URLEncodedFormEncoder(context: context,\n                                      codingPath: codingPath,\n                                      boolEncoding: boolEncoding,\n                                      dataEncoding: dataEncoding,\n                                      dateEncoding: dateEncoding)\n    }\n}\n\nfinal class URLEncodedFormSerializer {\n    private let alphabetizeKeyValuePairs: Bool\n    private let arrayEncoding: URLEncodedFormEncoder.ArrayEncoding\n    private let keyEncoding: URLEncodedFormEncoder.KeyEncoding\n    private let spaceEncoding: URLEncodedFormEncoder.SpaceEncoding\n    private let allowedCharacters: CharacterSet\n\n    init(alphabetizeKeyValuePairs: Bool,\n         arrayEncoding: URLEncodedFormEncoder.ArrayEncoding,\n         keyEncoding: URLEncodedFormEncoder.KeyEncoding,\n         spaceEncoding: URLEncodedFormEncoder.SpaceEncoding,\n         allowedCharacters: CharacterSet) {\n        self.alphabetizeKeyValuePairs = alphabetizeKeyValuePairs\n        self.arrayEncoding = arrayEncoding\n        self.keyEncoding = keyEncoding\n        self.spaceEncoding = spaceEncoding\n        self.allowedCharacters = allowedCharacters\n    }\n\n    func serialize(_ object: URLEncodedFormComponent.Object) -> String {\n        var output: [String] = []\n        for (key, component) in object {\n            let value = serialize(component, forKey: key)\n            output.append(value)\n        }\n        output = alphabetizeKeyValuePairs ? output.sorted() : output\n\n        return output.joinedWithAmpersands()\n    }\n\n    func serialize(_ component: URLEncodedFormComponent, forKey key: String) -> String {\n        switch component {\n        case let .string(string): return \"\\(escape(keyEncoding.encode(key)))=\\(escape(string))\"\n        case let .array(array): return serialize(array, forKey: key)\n        case let .object(object): return serialize(object, forKey: key)\n        }\n    }\n\n    func serialize(_ object: URLEncodedFormComponent.Object, forKey key: String) -> String {\n        var segments: [String] = object.map { subKey, value in\n            let keyPath = \"[\\(subKey)]\"\n            return serialize(value, forKey: key + keyPath)\n        }\n        segments = alphabetizeKeyValuePairs ? segments.sorted() : segments\n\n        return segments.joinedWithAmpersands()\n    }\n\n    func serialize(_ array: [URLEncodedFormComponent], forKey key: String) -> String {\n        var segments: [String] = array.map { component in\n            let keyPath = arrayEncoding.encode(key)\n            return serialize(component, forKey: keyPath)\n        }\n        segments = alphabetizeKeyValuePairs ? segments.sorted() : segments\n\n        return segments.joinedWithAmpersands()\n    }\n\n    func escape(_ query: String) -> String {\n        var allowedCharactersWithSpace = allowedCharacters\n        allowedCharactersWithSpace.insert(charactersIn: \" \")\n        let escapedQuery = query.addingPercentEncoding(withAllowedCharacters: allowedCharactersWithSpace) ?? query\n        let spaceEncodedQuery = spaceEncoding.encode(escapedQuery)\n\n        return spaceEncodedQuery\n    }\n}\n\nextension Array where Element == String {\n    func joinedWithAmpersands() -> String {\n        return joined(separator: \"&\")\n    }\n}\n\npublic extension CharacterSet {\n    /// Creates a CharacterSet from RFC 3986 allowed characters.\n    ///\n    /// RFC 3986 states that the following characters are \"reserved\" characters.\n    ///\n    /// - General Delimiters: \":\", \"#\", \"[\", \"]\", \"@\", \"?\", \"/\"\n    /// - Sub-Delimiters: \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\"\n    ///\n    /// In RFC 3986 - Section 3.4, it states that the \"?\" and \"/\" characters should not be escaped to allow\n    /// query strings to include a URL. Therefore, all \"reserved\" characters with the exception of \"?\" and \"/\"\n    /// should be percent-escaped in the query string.\n    static let afURLQueryAllowed: CharacterSet = {\n        let generalDelimitersToEncode = \":#[]@\" // does not include \"?\" or \"/\" due to RFC 3986 - Section 3.4\n        let subDelimitersToEncode = \"!$&'()*+,;=\"\n        let encodableDelimiters = CharacterSet(charactersIn: \"\\(generalDelimitersToEncode)\\(subDelimitersToEncode)\")\n\n        return CharacterSet.urlQueryAllowed.subtracting(encodableDelimiters)\n    }()\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/URLRequest+Alamofire.swift",
    "content": "//\n//  URLRequest+Alamofire.swift\n//\n//  Copyright (c) 2019 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\npublic extension URLRequest {\n    /// Returns the `httpMethod` as Alamofire's `HTTPMethod` type.\n    var method: HTTPMethod? {\n        get { return httpMethod.flatMap(HTTPMethod.init) }\n        set { httpMethod = newValue?.rawValue }\n    }\n\n    func validate() throws {\n        if method == .get, let bodyData = httpBody {\n            throw AFError.urlRequestValidationFailed(reason: .bodyDataInGETRequest(bodyData))\n        }\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift",
    "content": "//\n//  URLSessionConfiguration+Alamofire.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\nextension URLSessionConfiguration: AlamofireExtended {}\nextension AlamofireExtension where ExtendedType: URLSessionConfiguration {\n    /// Alamofire's default configuration. Same as `URLSessionConfiguration.default` but adds Alamofire default\n    /// `Accept-Language`, `Accept-Encoding`, and `User-Agent` headers.\n    public static var `default`: URLSessionConfiguration {\n        let configuration = URLSessionConfiguration.default\n        configuration.headers = .default\n\n        return configuration\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Alamofire/Source/Validation.swift",
    "content": "//\n//  Validation.swift\n//\n//  Copyright (c) 2014-2018 Alamofire Software Foundation (http://alamofire.org/)\n//\n//  Permission is hereby granted, free of charge, to any person obtaining a copy\n//  of this software and associated documentation files (the \"Software\"), to deal\n//  in the Software without restriction, including without limitation the rights\n//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n//  copies of the Software, and to permit persons to whom the Software is\n//  furnished to do so, subject to the following conditions:\n//\n//  The above copyright notice and this permission notice shall be included in\n//  all copies or substantial portions of the Software.\n//\n//  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n//  THE SOFTWARE.\n//\n\nimport Foundation\n\nextension Request {\n    // MARK: Helper Types\n\n    fileprivate typealias ErrorReason = AFError.ResponseValidationFailureReason\n\n    /// Used to represent whether a validation succeeded or failed.\n    public typealias ValidationResult = Result<Void, Error>\n\n    fileprivate struct MIMEType {\n        let type: String\n        let subtype: String\n\n        var isWildcard: Bool { return type == \"*\" && subtype == \"*\" }\n\n        init?(_ string: String) {\n            let components: [String] = {\n                let stripped = string.trimmingCharacters(in: .whitespacesAndNewlines)\n                let split = stripped[..<(stripped.range(of: \";\")?.lowerBound ?? stripped.endIndex)]\n\n                return split.components(separatedBy: \"/\")\n            }()\n\n            if let type = components.first, let subtype = components.last {\n                self.type = type\n                self.subtype = subtype\n            } else {\n                return nil\n            }\n        }\n\n        func matches(_ mime: MIMEType) -> Bool {\n            switch (type, subtype) {\n            case (mime.type, mime.subtype), (mime.type, \"*\"), (\"*\", mime.subtype), (\"*\", \"*\"):\n                return true\n            default:\n                return false\n            }\n        }\n    }\n\n    // MARK: Properties\n\n    fileprivate var acceptableStatusCodes: Range<Int> { return 200..<300 }\n\n    fileprivate var acceptableContentTypes: [String] {\n        if let accept = request?.value(forHTTPHeaderField: \"Accept\") {\n            return accept.components(separatedBy: \",\")\n        }\n\n        return [\"*/*\"]\n    }\n\n    // MARK: Status Code\n\n    fileprivate func validate<S: Sequence>(statusCode acceptableStatusCodes: S,\n                                           response: HTTPURLResponse)\n        -> ValidationResult\n        where S.Iterator.Element == Int {\n        if acceptableStatusCodes.contains(response.statusCode) {\n            return .success(Void())\n        } else {\n            let reason: ErrorReason = .unacceptableStatusCode(code: response.statusCode)\n            return .failure(AFError.responseValidationFailed(reason: reason))\n        }\n    }\n\n    // MARK: Content Type\n\n    fileprivate func validate<S: Sequence>(contentType acceptableContentTypes: S,\n                                           response: HTTPURLResponse,\n                                           data: Data?)\n        -> ValidationResult\n        where S.Iterator.Element == String {\n        guard let data = data, !data.isEmpty else { return .success(Void()) }\n\n        guard\n            let responseContentType = response.mimeType,\n            let responseMIMEType = MIMEType(responseContentType)\n        else {\n            for contentType in acceptableContentTypes {\n                if let mimeType = MIMEType(contentType), mimeType.isWildcard {\n                    return .success(Void())\n                }\n            }\n\n            let error: AFError = {\n                let reason: ErrorReason = .missingContentType(acceptableContentTypes: Array(acceptableContentTypes))\n                return AFError.responseValidationFailed(reason: reason)\n            }()\n\n            return .failure(error)\n        }\n\n        for contentType in acceptableContentTypes {\n            if let acceptableMIMEType = MIMEType(contentType), acceptableMIMEType.matches(responseMIMEType) {\n                return .success(Void())\n            }\n        }\n\n        let error: AFError = {\n            let reason: ErrorReason = .unacceptableContentType(acceptableContentTypes: Array(acceptableContentTypes),\n                                                               responseContentType: responseContentType)\n\n            return AFError.responseValidationFailed(reason: reason)\n        }()\n\n        return .failure(error)\n    }\n}\n\n// MARK: -\n\nextension DataRequest {\n    /// A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the\n    /// request was valid.\n    public typealias Validation = (URLRequest?, HTTPURLResponse, Data?) -> ValidationResult\n\n    /// Validates that the response has a status code in the specified sequence.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - parameter range: The range of acceptable status codes.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {\n        return validate { [unowned self] _, response, _ in\n            self.validate(statusCode: acceptableStatusCodes, response: response)\n        }\n    }\n\n    /// Validates that the response has a content type in the specified sequence.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {\n        return validate { [unowned self] _, response, data in\n            self.validate(contentType: acceptableContentTypes(), response: response, data: data)\n        }\n    }\n\n    /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content\n    /// type matches any specified in the Accept HTTP header field.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate() -> Self {\n        let contentTypes: () -> [String] = { [unowned self] in\n            self.acceptableContentTypes\n        }\n        return validate(statusCode: acceptableStatusCodes).validate(contentType: contentTypes())\n    }\n}\n\n// MARK: -\n\nextension DownloadRequest {\n    /// A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a\n    /// destination URL, and returns whether the request was valid.\n    public typealias Validation = (_ request: URLRequest?,\n                                   _ response: HTTPURLResponse,\n                                   _ fileURL: URL?)\n        -> ValidationResult\n\n    /// Validates that the response has a status code in the specified sequence.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - parameter range: The range of acceptable status codes.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {\n        return validate { [unowned self] _, response, _ in\n            self.validate(statusCode: acceptableStatusCodes, response: response)\n        }\n    }\n\n    /// Validates that the response has a content type in the specified sequence.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - parameter contentType: The acceptable content types, which may specify wildcard types and/or subtypes.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {\n        return validate { [unowned self] _, response, fileURL in\n            guard let validFileURL = fileURL else {\n                return .failure(AFError.responseValidationFailed(reason: .dataFileNil))\n            }\n\n            do {\n                let data = try Data(contentsOf: validFileURL)\n                return self.validate(contentType: acceptableContentTypes(), response: response, data: data)\n            } catch {\n                return .failure(AFError.responseValidationFailed(reason: .dataFileReadFailed(at: validFileURL)))\n            }\n        }\n    }\n\n    /// Validates that the response has a status code in the default acceptable range of 200...299, and that the content\n    /// type matches any specified in the Accept HTTP header field.\n    ///\n    /// If validation fails, subsequent calls to response handlers will have an associated error.\n    ///\n    /// - returns: The request.\n    @discardableResult\n    public func validate() -> Self {\n        let contentTypes = { [unowned self] in\n            self.acceptableContentTypes\n        }\n        return validate(statusCode: acceptableStatusCodes).validate(contentType: contentTypes())\n    }\n}\n"
  },
  {
    "path": "Example/Pods/Local Podspecs/ErrorHandler.podspec.json",
    "content": "{\n  \"name\": \"ErrorHandler\",\n  \"version\": \"0.8.4\",\n  \"swift_versions\": [\n    \"4.2\",\n    \"5.0\"\n  ],\n  \"summary\": \"Elegant and flexible error handling for Swift\",\n  \"description\": \"> Elegant and flexible error handling for Swift\\n\\nErrorHandler enables expressing complex error handling logic with a few lines of code using a memorable fluent API.\",\n  \"homepage\": \"https://github.com/Workable/swift-error-handler\",\n  \"license\": {\n    \"type\": \"MIT\",\n    \"file\": \"LICENSE\"\n  },\n  \"authors\": {\n    \"Kostas Kremizas\": \"kremizask@gmail.com\",\n    \"Eleni Papanikolopoulou\": \"eleni.papanikolopoulou@gmail.com\"\n  },\n  \"platforms\": {\n    \"ios\": \"10.0\",\n    \"osx\": \"10.12\",\n    \"tvos\": \"10.0\",\n    \"watchos\": \"3.0\"\n  },\n  \"source\": {\n    \"git\": \"https://github.com/Workable/swift-error-handler.git\",\n    \"tag\": \"0.8.4\"\n  },\n  \"default_subspecs\": \"Core\",\n  \"subspecs\": [\n    {\n      \"name\": \"Core\",\n      \"source_files\": \"ErrorHandler/Classes/Core/**/*\",\n      \"frameworks\": \"Foundation\"\n    },\n    {\n      \"name\": \"Alamofire\",\n      \"source_files\": \"ErrorHandler/Classes/Alamofire/**/*\",\n      \"dependencies\": {\n        \"Alamofire\": [\n          \"~> 5\"\n        ],\n        \"ErrorHandler/Core\": [\n\n        ]\n      }\n    }\n  ],\n  \"swift_version\": \"5.0\"\n}\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Alamofire/Alamofire-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>5.0.2</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Alamofire/Alamofire-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_Alamofire : NSObject\n@end\n@implementation PodsDummy_Alamofire\n@end\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Alamofire/Alamofire-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Alamofire/Alamofire-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double AlamofireVersionNumber;\nFOUNDATION_EXPORT const unsigned char AlamofireVersionString[];\n\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Alamofire/Alamofire.modulemap",
    "content": "framework module Alamofire {\n  umbrella header \"Alamofire-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Alamofire/Alamofire.xcconfig",
    "content": "CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"CFNetwork\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/Alamofire\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Alamofire/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>4.5.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Pods/Target Support Files/ErrorHandler/ErrorHandler-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>0.8.4</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Pods/Target Support Files/ErrorHandler/ErrorHandler-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_ErrorHandler : NSObject\n@end\n@implementation PodsDummy_ErrorHandler\n@end\n"
  },
  {
    "path": "Example/Pods/Target Support Files/ErrorHandler/ErrorHandler-prefix.pch",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n"
  },
  {
    "path": "Example/Pods/Target Support Files/ErrorHandler/ErrorHandler-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double ErrorHandlerVersionNumber;\nFOUNDATION_EXPORT const unsigned char ErrorHandlerVersionString[];\n\n"
  },
  {
    "path": "Example/Pods/Target Support Files/ErrorHandler/ErrorHandler.modulemap",
    "content": "framework module ErrorHandler {\n  umbrella header \"ErrorHandler-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "Example/Pods/Target Support Files/ErrorHandler/ErrorHandler.xcconfig",
    "content": "CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/ErrorHandler\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nOTHER_LDFLAGS = $(inherited) -framework \"Foundation\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_ROOT = ${SRCROOT}\nPODS_TARGET_SRCROOT = ${PODS_ROOT}/../..\nPRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}\nSKIP_INSTALL = YES\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "Example/Pods/Target Support Files/ErrorHandler/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>0.8.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Pods-ErrorHandler_Example-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Pods-ErrorHandler_Example-acknowledgements.markdown",
    "content": "# Acknowledgements\nThis application makes use of the following third party libraries:\n\n## Alamofire\n\nCopyright (c) 2014-2020 Alamofire Software Foundation (http://alamofire.org/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n\n## ErrorHandler\n\nThe MIT License (MIT)\n\nCopyright (c) 2017 Workable SA\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\nGenerated by CocoaPods - https://cocoapods.org\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Pods-ErrorHandler_Example-acknowledgements.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>PreferenceSpecifiers</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>This application makes use of the following third party libraries:</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>Acknowledgements</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Copyright (c) 2014-2020 Alamofire Software Foundation (http://alamofire.org/)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>Alamofire</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>The MIT License (MIT)\n\nCopyright (c) 2017 Workable SA\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n</string>\n\t\t\t<key>License</key>\n\t\t\t<string>MIT</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>ErrorHandler</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Generated by CocoaPods - https://cocoapods.org</string>\n\t\t\t<key>Title</key>\n\t\t\t<string></string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t</array>\n\t<key>StringsTable</key>\n\t<string>Acknowledgements</string>\n\t<key>Title</key>\n\t<string>Acknowledgements</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Pods-ErrorHandler_Example-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_Pods_ErrorHandler_Example : NSObject\n@end\n@implementation PodsDummy_Pods_ErrorHandler_Example\n@end\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Pods-ErrorHandler_Example-frameworks.sh",
    "content": "#!/bin/sh\nset -e\nset -u\nset -o pipefail\n\nfunction on_error {\n  echo \"$(realpath -mq \"${0}\"):$1: error: Unexpected failure\"\n}\ntrap 'on_error $LINENO' ERR\n\nif [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then\n  # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy\n  # frameworks to, so exit 0 (signalling the script phase was successful).\n  exit 0\nfi\n\necho \"mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\nmkdir -p \"${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\nCOCOAPODS_PARALLEL_CODE_SIGN=\"${COCOAPODS_PARALLEL_CODE_SIGN:-false}\"\nSWIFT_STDLIB_PATH=\"${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"\n\n# Used as a return value for each invocation of `strip_invalid_archs` function.\nSTRIP_BINARY_RETVAL=0\n\n# This protects against multiple targets copying the same framework dependency at the same time. The solution\n# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html\nRSYNC_PROTECT_TMP_FILES=(--filter \"P .*.??????\")\n\n# Copies and strips a vendored framework\ninstall_framework()\n{\n  if [ -r \"${BUILT_PRODUCTS_DIR}/$1\" ]; then\n    local source=\"${BUILT_PRODUCTS_DIR}/$1\"\n  elif [ -r \"${BUILT_PRODUCTS_DIR}/$(basename \"$1\")\" ]; then\n    local source=\"${BUILT_PRODUCTS_DIR}/$(basename \"$1\")\"\n  elif [ -r \"$1\" ]; then\n    local source=\"$1\"\n  fi\n\n  local destination=\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\n  if [ -L \"${source}\" ]; then\n    echo \"Symlinked...\"\n    source=\"$(readlink \"${source}\")\"\n  fi\n\n  # Use filter instead of exclude so missing patterns don't throw errors.\n  echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \\\"- CVS/\\\" --filter \\\"- .svn/\\\" --filter \\\"- .git/\\\" --filter \\\"- .hg/\\\" --filter \\\"- Headers\\\" --filter \\\"- PrivateHeaders\\\" --filter \\\"- Modules\\\" \\\"${source}\\\" \\\"${destination}\\\"\"\n  rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"\n\n  local basename\n  basename=\"$(basename -s .framework \"$1\")\"\n  binary=\"${destination}/${basename}.framework/${basename}\"\n\n  if ! [ -r \"$binary\" ]; then\n    binary=\"${destination}/${basename}\"\n  elif [ -L \"${binary}\" ]; then\n    echo \"Destination binary is symlinked...\"\n    dirname=\"$(dirname \"${binary}\")\"\n    binary=\"${dirname}/$(readlink \"${binary}\")\"\n  fi\n\n  # Strip invalid architectures so \"fat\" simulator / device frameworks work on device\n  if [[ \"$(file \"$binary\")\" == *\"dynamically linked shared library\"* ]]; then\n    strip_invalid_archs \"$binary\"\n  fi\n\n  # Resign the code if required by the build settings to avoid unstable apps\n  code_sign_if_enabled \"${destination}/$(basename \"$1\")\"\n\n  # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.\n  if [ \"${XCODE_VERSION_MAJOR}\" -lt 7 ]; then\n    local swift_runtime_libs\n    swift_runtime_libs=$(xcrun otool -LX \"$binary\" | grep --color=never @rpath/libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u)\n    for lib in $swift_runtime_libs; do\n      echo \"rsync -auv \\\"${SWIFT_STDLIB_PATH}/${lib}\\\" \\\"${destination}\\\"\"\n      rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"\n      code_sign_if_enabled \"${destination}/${lib}\"\n    done\n  fi\n}\n\n# Copies and strips a vendored dSYM\ninstall_dsym() {\n  local source=\"$1\"\n  if [ -r \"$source\" ]; then\n    # Copy the dSYM into a the targets temp dir.\n    echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \\\"- CVS/\\\" --filter \\\"- .svn/\\\" --filter \\\"- .git/\\\" --filter \\\"- .hg/\\\" --filter \\\"- Headers\\\" --filter \\\"- PrivateHeaders\\\" --filter \\\"- Modules\\\" \\\"${source}\\\" \\\"${DERIVED_FILES_DIR}\\\"\"\n    rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"\n\n    local basename\n    basename=\"$(basename -s .framework.dSYM \"$source\")\"\n    binary=\"${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}\"\n\n    # Strip invalid architectures so \"fat\" simulator / device frameworks work on device\n    if [[ \"$(file \"$binary\")\" == *\"Mach-O \"*\"dSYM companion\"* ]]; then\n      strip_invalid_archs \"$binary\"\n    fi\n\n    if [[ $STRIP_BINARY_RETVAL == 1 ]]; then\n      # Move the stripped file into its final destination.\n      echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \\\"- CVS/\\\" --filter \\\"- .svn/\\\" --filter \\\"- .git/\\\" --filter \\\"- .hg/\\\" --filter \\\"- Headers\\\" --filter \\\"- PrivateHeaders\\\" --filter \\\"- Modules\\\" \\\"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\\\" \\\"${DWARF_DSYM_FOLDER_PATH}\\\"\"\n      rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"\n    else\n      # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.\n      touch \"${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM\"\n    fi\n  fi\n}\n\n# Copies the bcsymbolmap files of a vendored framework\ninstall_bcsymbolmap() {\n    local bcsymbolmap_path=\"$1\"\n    local destination=\"${BUILT_PRODUCTS_DIR}\"\n    echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${bcsymbolmap_path}\" \"${destination}\"\"\n    rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${bcsymbolmap_path}\" \"${destination}\"\n}\n\n# Signs a framework with the provided identity\ncode_sign_if_enabled() {\n  if [ -n \"${EXPANDED_CODE_SIGN_IDENTITY:-}\" -a \"${CODE_SIGNING_REQUIRED:-}\" != \"NO\" -a \"${CODE_SIGNING_ALLOWED}\" != \"NO\" ]; then\n    # Use the current code_sign_identity\n    echo \"Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}\"\n    local code_sign_cmd=\"/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'\"\n\n    if [ \"${COCOAPODS_PARALLEL_CODE_SIGN}\" == \"true\" ]; then\n      code_sign_cmd=\"$code_sign_cmd &\"\n    fi\n    echo \"$code_sign_cmd\"\n    eval \"$code_sign_cmd\"\n  fi\n}\n\n# Strip invalid architectures\nstrip_invalid_archs() {\n  binary=\"$1\"\n  # Get architectures for current target binary\n  binary_archs=\"$(lipo -info \"$binary\" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)\"\n  # Intersect them with the architectures we are building for\n  intersected_archs=\"$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\\n' | sort | uniq -d)\"\n  # If there are no archs supported by this binary then warn the user\n  if [[ -z \"$intersected_archs\" ]]; then\n    echo \"warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS).\"\n    STRIP_BINARY_RETVAL=0\n    return\n  fi\n  stripped=\"\"\n  for arch in $binary_archs; do\n    if ! [[ \"${ARCHS}\" == *\"$arch\"* ]]; then\n      # Strip non-valid architectures in-place\n      lipo -remove \"$arch\" -output \"$binary\" \"$binary\"\n      stripped=\"$stripped $arch\"\n    fi\n  done\n  if [[ \"$stripped\" ]]; then\n    echo \"Stripped $binary of architectures:$stripped\"\n  fi\n  STRIP_BINARY_RETVAL=1\n}\n\n\nif [[ \"$CONFIGURATION\" == \"Debug\" ]]; then\n  install_framework \"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/ErrorHandler/ErrorHandler.framework\"\nfi\nif [[ \"$CONFIGURATION\" == \"Release\" ]]; then\n  install_framework \"${BUILT_PRODUCTS_DIR}/Alamofire/Alamofire.framework\"\n  install_framework \"${BUILT_PRODUCTS_DIR}/ErrorHandler/ErrorHandler.framework\"\nfi\nif [ \"${COCOAPODS_PARALLEL_CODE_SIGN}\" == \"true\" ]; then\n  wait\nfi\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Pods-ErrorHandler_Example-resources.sh",
    "content": "#!/bin/sh\nset -e\n\nmkdir -p \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\n\nRESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt\n> \"$RESOURCES_TO_COPY\"\n\nXCASSET_FILES=()\n\n# This protects against multiple targets copying the same framework dependency at the same time. The solution\n# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html\nRSYNC_PROTECT_TMP_FILES=(--filter \"P .*.??????\")\n\ncase \"${TARGETED_DEVICE_FAMILY}\" in\n  1,2)\n    TARGET_DEVICE_ARGS=\"--target-device ipad --target-device iphone\"\n    ;;\n  1)\n    TARGET_DEVICE_ARGS=\"--target-device iphone\"\n    ;;\n  2)\n    TARGET_DEVICE_ARGS=\"--target-device ipad\"\n    ;;\n  3)\n    TARGET_DEVICE_ARGS=\"--target-device tv\"\n    ;;\n  4)\n    TARGET_DEVICE_ARGS=\"--target-device watch\"\n    ;;\n  *)\n    TARGET_DEVICE_ARGS=\"--target-device mac\"\n    ;;\nesac\n\ninstall_resource()\n{\n  if [[ \"$1\" = /* ]] ; then\n    RESOURCE_PATH=\"$1\"\n  else\n    RESOURCE_PATH=\"${PODS_ROOT}/$1\"\n  fi\n  if [[ ! -e \"$RESOURCE_PATH\" ]] ; then\n    cat << EOM\nerror: Resource \"$RESOURCE_PATH\" not found. Run 'pod install' to update the copy resources script.\nEOM\n    exit 1\n  fi\n  case $RESOURCE_PATH in\n    *.storyboard)\n      echo \"ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}\" || true\n      ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .storyboard`.storyboardc\" \"$RESOURCE_PATH\" --sdk \"${SDKROOT}\" ${TARGET_DEVICE_ARGS}\n      ;;\n    *.xib)\n      echo \"ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}\" || true\n      ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .xib`.nib\" \"$RESOURCE_PATH\" --sdk \"${SDKROOT}\" ${TARGET_DEVICE_ARGS}\n      ;;\n    *.framework)\n      echo \"mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\" || true\n      mkdir -p \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n      echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\" || true\n      rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n      ;;\n    *.xcdatamodel)\n      echo \"xcrun momc \\\"$RESOURCE_PATH\\\" \\\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\"`.mom\\\"\" || true\n      xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcdatamodel`.mom\"\n      ;;\n    *.xcdatamodeld)\n      echo \"xcrun momc \\\"$RESOURCE_PATH\\\" \\\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcdatamodeld`.momd\\\"\" || true\n      xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcdatamodeld`.momd\"\n      ;;\n    *.xcmappingmodel)\n      echo \"xcrun mapc \\\"$RESOURCE_PATH\\\" \\\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcmappingmodel`.cdm\\\"\" || true\n      xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcmappingmodel`.cdm\"\n      ;;\n    *.xcassets)\n      ABSOLUTE_XCASSET_FILE=\"$RESOURCE_PATH\"\n      XCASSET_FILES+=(\"$ABSOLUTE_XCASSET_FILE\")\n      ;;\n    *)\n      echo \"$RESOURCE_PATH\" || true\n      echo \"$RESOURCE_PATH\" >> \"$RESOURCES_TO_COPY\"\n      ;;\n  esac\n}\n\nmkdir -p \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nrsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from=\"$RESOURCES_TO_COPY\" / \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nif [[ \"${ACTION}\" == \"install\" ]] && [[ \"${SKIP_INSTALL}\" == \"NO\" ]]; then\n  mkdir -p \"${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\n  rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from=\"$RESOURCES_TO_COPY\" / \"${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nfi\nrm -f \"$RESOURCES_TO_COPY\"\n\nif [[ -n \"${WRAPPER_EXTENSION}\" ]] && [ \"`xcrun --find actool`\" ] && [ -n \"$XCASSET_FILES\" ]\nthen\n  # Find all other xcassets (this unfortunately includes those of path pods and other targets).\n  OTHER_XCASSETS=$(find \"$PWD\" -iname \"*.xcassets\" -type d)\n  while read line; do\n    if [[ $line != \"${PODS_ROOT}*\" ]]; then\n      XCASSET_FILES+=(\"$line\")\n    fi\n  done <<<\"$OTHER_XCASSETS\"\n\n  printf \"%s\\0\" \"${XCASSET_FILES[@]}\" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform \"${PLATFORM_NAME}\" --minimum-deployment-target \"${!DEPLOYMENT_TARGET_SETTING_NAME}\" ${TARGET_DEVICE_ARGS} --compress-pngs --compile \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nfi\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Pods-ErrorHandler_Example-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double Pods_ErrorHandler_ExampleVersionNumber;\nFOUNDATION_EXPORT const unsigned char Pods_ErrorHandler_ExampleVersionString[];\n\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Pods-ErrorHandler_Example.debug.xcconfig",
    "content": "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\" \"${PODS_CONFIGURATION_BUILD_DIR}/ErrorHandler\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nHEADER_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ErrorHandler/ErrorHandler.framework/Headers\"\nLD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'\nOTHER_LDFLAGS = $(inherited) -framework \"Alamofire\" -framework \"CFNetwork\" -framework \"ErrorHandler\" -framework \"Foundation\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_PODFILE_DIR_PATH = ${SRCROOT}/.\nPODS_ROOT = ${SRCROOT}/Pods\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Pods-ErrorHandler_Example.modulemap",
    "content": "framework module Pods_ErrorHandler_Example {\n  umbrella header \"Pods-ErrorHandler_Example-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Example/Pods-ErrorHandler_Example.release.xcconfig",
    "content": "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES\nFRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\" \"${PODS_CONFIGURATION_BUILD_DIR}/ErrorHandler\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nHEADER_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ErrorHandler/ErrorHandler.framework/Headers\"\nLD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'\nOTHER_LDFLAGS = $(inherited) -framework \"Alamofire\" -framework \"CFNetwork\" -framework \"ErrorHandler\" -framework \"Foundation\"\nOTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_PODFILE_DIR_PATH = ${SRCROOT}/.\nPODS_ROOT = ${SRCROOT}/Pods\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Pods-ErrorHandler_Tests-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>${EXECUTABLE_NAME}</string>\n  <key>CFBundleIdentifier</key>\n  <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>${PRODUCT_NAME}</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>${CURRENT_PROJECT_VERSION}</string>\n  <key>NSPrincipalClass</key>\n  <string></string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Pods-ErrorHandler_Tests-acknowledgements.markdown",
    "content": "# Acknowledgements\nThis application makes use of the following third party libraries:\nGenerated by CocoaPods - https://cocoapods.org\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Pods-ErrorHandler_Tests-acknowledgements.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>PreferenceSpecifiers</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>This application makes use of the following third party libraries:</string>\n\t\t\t<key>Title</key>\n\t\t\t<string>Acknowledgements</string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>FooterText</key>\n\t\t\t<string>Generated by CocoaPods - https://cocoapods.org</string>\n\t\t\t<key>Title</key>\n\t\t\t<string></string>\n\t\t\t<key>Type</key>\n\t\t\t<string>PSGroupSpecifier</string>\n\t\t</dict>\n\t</array>\n\t<key>StringsTable</key>\n\t<string>Acknowledgements</string>\n\t<key>Title</key>\n\t<string>Acknowledgements</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Pods-ErrorHandler_Tests-dummy.m",
    "content": "#import <Foundation/Foundation.h>\n@interface PodsDummy_Pods_ErrorHandler_Tests : NSObject\n@end\n@implementation PodsDummy_Pods_ErrorHandler_Tests\n@end\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Pods-ErrorHandler_Tests-frameworks.sh",
    "content": "#!/bin/sh\nset -e\n\necho \"mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\nmkdir -p \"${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\nSWIFT_STDLIB_PATH=\"${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}\"\n\n# This protects against multiple targets copying the same framework dependency at the same time. The solution\n# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html\nRSYNC_PROTECT_TMP_FILES=(--filter \"P .*.??????\")\n\ninstall_framework()\n{\n  if [ -r \"${BUILT_PRODUCTS_DIR}/$1\" ]; then\n    local source=\"${BUILT_PRODUCTS_DIR}/$1\"\n  elif [ -r \"${BUILT_PRODUCTS_DIR}/$(basename \"$1\")\" ]; then\n    local source=\"${BUILT_PRODUCTS_DIR}/$(basename \"$1\")\"\n  elif [ -r \"$1\" ]; then\n    local source=\"$1\"\n  fi\n\n  local destination=\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n\n  if [ -L \"${source}\" ]; then\n      echo \"Symlinked...\"\n      source=\"$(readlink \"${source}\")\"\n  fi\n\n  # Use filter instead of exclude so missing patterns don't throw errors.\n  echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \\\"- CVS/\\\" --filter \\\"- .svn/\\\" --filter \\\"- .git/\\\" --filter \\\"- .hg/\\\" --filter \\\"- Headers\\\" --filter \\\"- PrivateHeaders\\\" --filter \\\"- Modules\\\" \\\"${source}\\\" \\\"${destination}\\\"\"\n  rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"\n\n  local basename\n  basename=\"$(basename -s .framework \"$1\")\"\n  binary=\"${destination}/${basename}.framework/${basename}\"\n  if ! [ -r \"$binary\" ]; then\n    binary=\"${destination}/${basename}\"\n  fi\n\n  # Strip invalid architectures so \"fat\" simulator / device frameworks work on device\n  if [[ \"$(file \"$binary\")\" == *\"dynamically linked shared library\"* ]]; then\n    strip_invalid_archs \"$binary\"\n  fi\n\n  # Resign the code if required by the build settings to avoid unstable apps\n  code_sign_if_enabled \"${destination}/$(basename \"$1\")\"\n\n  # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.\n  if [ \"${XCODE_VERSION_MAJOR}\" -lt 7 ]; then\n    local swift_runtime_libs\n    swift_runtime_libs=$(xcrun otool -LX \"$binary\" | grep --color=never @rpath/libswift | sed -E s/@rpath\\\\/\\(.+dylib\\).*/\\\\1/g | uniq -u  && exit ${PIPESTATUS[0]})\n    for lib in $swift_runtime_libs; do\n      echo \"rsync -auv \\\"${SWIFT_STDLIB_PATH}/${lib}\\\" \\\"${destination}\\\"\"\n      rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"\n      code_sign_if_enabled \"${destination}/${lib}\"\n    done\n  fi\n}\n\n# Copies the dSYM of a vendored framework\ninstall_dsym() {\n  local source=\"$1\"\n  if [ -r \"$source\" ]; then\n    echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \\\"- CVS/\\\" --filter \\\"- .svn/\\\" --filter \\\"- .git/\\\" --filter \\\"- .hg/\\\" --filter \\\"- Headers\\\" --filter \\\"- PrivateHeaders\\\" --filter \\\"- Modules\\\" \\\"${source}\\\" \\\"${DWARF_DSYM_FOLDER_PATH}\\\"\"\n    rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\"\n  fi\n}\n\n# Signs a framework with the provided identity\ncode_sign_if_enabled() {\n  if [ -n \"${EXPANDED_CODE_SIGN_IDENTITY}\" -a \"${CODE_SIGNING_REQUIRED}\" != \"NO\" -a \"${CODE_SIGNING_ALLOWED}\" != \"NO\" ]; then\n    # Use the current code_sign_identitiy\n    echo \"Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}\"\n    local code_sign_cmd=\"/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'\"\n\n    if [ \"${COCOAPODS_PARALLEL_CODE_SIGN}\" == \"true\" ]; then\n      code_sign_cmd=\"$code_sign_cmd &\"\n    fi\n    echo \"$code_sign_cmd\"\n    eval \"$code_sign_cmd\"\n  fi\n}\n\n# Strip invalid architectures\nstrip_invalid_archs() {\n  binary=\"$1\"\n  # Get architectures for current file\n  archs=\"$(lipo -info \"$binary\" | rev | cut -d ':' -f1 | rev)\"\n  stripped=\"\"\n  for arch in $archs; do\n    if ! [[ \"${ARCHS}\" == *\"$arch\"* ]]; then\n      # Strip non-valid architectures in-place\n      lipo -remove \"$arch\" -output \"$binary\" \"$binary\" || exit 1\n      stripped=\"$stripped $arch\"\n    fi\n  done\n  if [[ \"$stripped\" ]]; then\n    echo \"Stripped $binary of architectures:$stripped\"\n  fi\n}\n\nif [ \"${COCOAPODS_PARALLEL_CODE_SIGN}\" == \"true\" ]; then\n  wait\nfi\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Pods-ErrorHandler_Tests-resources.sh",
    "content": "#!/bin/sh\nset -e\n\nmkdir -p \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\n\nRESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt\n> \"$RESOURCES_TO_COPY\"\n\nXCASSET_FILES=()\n\n# This protects against multiple targets copying the same framework dependency at the same time. The solution\n# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html\nRSYNC_PROTECT_TMP_FILES=(--filter \"P .*.??????\")\n\ncase \"${TARGETED_DEVICE_FAMILY}\" in\n  1,2)\n    TARGET_DEVICE_ARGS=\"--target-device ipad --target-device iphone\"\n    ;;\n  1)\n    TARGET_DEVICE_ARGS=\"--target-device iphone\"\n    ;;\n  2)\n    TARGET_DEVICE_ARGS=\"--target-device ipad\"\n    ;;\n  3)\n    TARGET_DEVICE_ARGS=\"--target-device tv\"\n    ;;\n  4)\n    TARGET_DEVICE_ARGS=\"--target-device watch\"\n    ;;\n  *)\n    TARGET_DEVICE_ARGS=\"--target-device mac\"\n    ;;\nesac\n\ninstall_resource()\n{\n  if [[ \"$1\" = /* ]] ; then\n    RESOURCE_PATH=\"$1\"\n  else\n    RESOURCE_PATH=\"${PODS_ROOT}/$1\"\n  fi\n  if [[ ! -e \"$RESOURCE_PATH\" ]] ; then\n    cat << EOM\nerror: Resource \"$RESOURCE_PATH\" not found. Run 'pod install' to update the copy resources script.\nEOM\n    exit 1\n  fi\n  case $RESOURCE_PATH in\n    *.storyboard)\n      echo \"ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}\" || true\n      ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .storyboard`.storyboardc\" \"$RESOURCE_PATH\" --sdk \"${SDKROOT}\" ${TARGET_DEVICE_ARGS}\n      ;;\n    *.xib)\n      echo \"ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}\" || true\n      ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \\\"$RESOURCE_PATH\\\" .xib`.nib\" \"$RESOURCE_PATH\" --sdk \"${SDKROOT}\" ${TARGET_DEVICE_ARGS}\n      ;;\n    *.framework)\n      echo \"mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\" || true\n      mkdir -p \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n      echo \"rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\" || true\n      rsync --delete -av \"${RSYNC_PROTECT_TMP_FILES[@]}\" \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}\"\n      ;;\n    *.xcdatamodel)\n      echo \"xcrun momc \\\"$RESOURCE_PATH\\\" \\\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\"`.mom\\\"\" || true\n      xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcdatamodel`.mom\"\n      ;;\n    *.xcdatamodeld)\n      echo \"xcrun momc \\\"$RESOURCE_PATH\\\" \\\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcdatamodeld`.momd\\\"\" || true\n      xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcdatamodeld`.momd\"\n      ;;\n    *.xcmappingmodel)\n      echo \"xcrun mapc \\\"$RESOURCE_PATH\\\" \\\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcmappingmodel`.cdm\\\"\" || true\n      xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xcmappingmodel`.cdm\"\n      ;;\n    *.xcassets)\n      ABSOLUTE_XCASSET_FILE=\"$RESOURCE_PATH\"\n      XCASSET_FILES+=(\"$ABSOLUTE_XCASSET_FILE\")\n      ;;\n    *)\n      echo \"$RESOURCE_PATH\" || true\n      echo \"$RESOURCE_PATH\" >> \"$RESOURCES_TO_COPY\"\n      ;;\n  esac\n}\n\nmkdir -p \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nrsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from=\"$RESOURCES_TO_COPY\" / \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nif [[ \"${ACTION}\" == \"install\" ]] && [[ \"${SKIP_INSTALL}\" == \"NO\" ]]; then\n  mkdir -p \"${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\n  rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from=\"$RESOURCES_TO_COPY\" / \"${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nfi\nrm -f \"$RESOURCES_TO_COPY\"\n\nif [[ -n \"${WRAPPER_EXTENSION}\" ]] && [ \"`xcrun --find actool`\" ] && [ -n \"$XCASSET_FILES\" ]\nthen\n  # Find all other xcassets (this unfortunately includes those of path pods and other targets).\n  OTHER_XCASSETS=$(find \"$PWD\" -iname \"*.xcassets\" -type d)\n  while read line; do\n    if [[ $line != \"${PODS_ROOT}*\" ]]; then\n      XCASSET_FILES+=(\"$line\")\n    fi\n  done <<<\"$OTHER_XCASSETS\"\n\n  printf \"%s\\0\" \"${XCASSET_FILES[@]}\" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform \"${PLATFORM_NAME}\" --minimum-deployment-target \"${!DEPLOYMENT_TARGET_SETTING_NAME}\" ${TARGET_DEVICE_ARGS} --compress-pngs --compile \"${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}\"\nfi\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Pods-ErrorHandler_Tests-umbrella.h",
    "content": "#ifdef __OBJC__\n#import <UIKit/UIKit.h>\n#else\n#ifndef FOUNDATION_EXPORT\n#if defined(__cplusplus)\n#define FOUNDATION_EXPORT extern \"C\"\n#else\n#define FOUNDATION_EXPORT extern\n#endif\n#endif\n#endif\n\n\nFOUNDATION_EXPORT double Pods_ErrorHandler_TestsVersionNumber;\nFOUNDATION_EXPORT const unsigned char Pods_ErrorHandler_TestsVersionString[];\n\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Pods-ErrorHandler_Tests.debug.xcconfig",
    "content": "FRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\" \"${PODS_CONFIGURATION_BUILD_DIR}/ErrorHandler\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nHEADER_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ErrorHandler/ErrorHandler.framework/Headers\"\nOTHER_LDFLAGS = $(inherited) -framework \"Alamofire\" -framework \"CFNetwork\" -framework \"ErrorHandler\" -framework \"Foundation\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_PODFILE_DIR_PATH = ${SRCROOT}/.\nPODS_ROOT = ${SRCROOT}/Pods\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Pods-ErrorHandler_Tests.modulemap",
    "content": "framework module Pods_ErrorHandler_Tests {\n  umbrella header \"Pods-ErrorHandler_Tests-umbrella.h\"\n\n  export *\n  module * { export * }\n}\n"
  },
  {
    "path": "Example/Pods/Target Support Files/Pods-ErrorHandler_Tests/Pods-ErrorHandler_Tests.release.xcconfig",
    "content": "FRAMEWORK_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire\" \"${PODS_CONFIGURATION_BUILD_DIR}/ErrorHandler\"\nGCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1\nHEADER_SEARCH_PATHS = $(inherited) \"${PODS_CONFIGURATION_BUILD_DIR}/Alamofire/Alamofire.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ErrorHandler/ErrorHandler.framework/Headers\"\nOTHER_LDFLAGS = $(inherited) -framework \"Alamofire\" -framework \"CFNetwork\" -framework \"ErrorHandler\" -framework \"Foundation\"\nPODS_BUILD_DIR = ${BUILD_DIR}\nPODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\nPODS_PODFILE_DIR_PATH = ${SRCROOT}/.\nPODS_ROOT = ${SRCROOT}/Pods\nUSE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES\n"
  },
  {
    "path": "Example/Tests/AFErrorStatusCodeMatcherTests.swift",
    "content": "//\n//  AFErrorStatusCodeMatcherTests.swift\n//  ErrorHandler-AFExtensions\n//\n//  Created by Kostas Kremizas on 30/08/2017.\n//  Copyright © 2017 Workable SA. All rights reserved.\n//\n\nimport Foundation\nimport XCTest\nimport Alamofire\nimport ErrorHandler\n\nclass AFErrorStatusCodeMatcherTests: XCTestCase {\n    \n    func testThatItMatchesErrorWithSameStatus() {\n        let code = 404\n        let error = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: code))\n        \n        let matcher = AFErrorStatusCodeMatcher(statusCode: code)\n        \n        XCTAssertTrue(matcher.matches(error))\n    }\n    \n    func testThatItDoesntMatchErrorWithOtherStatus() {\n        let error = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: 404))\n        \n        let matcher = AFErrorStatusCodeMatcher(statusCode: 400)\n        \n        XCTAssertFalse(matcher.matches(error))\n    }\n    \n    func testThatItMatchesErrorInCorrectRange() {\n        let matcher = AFErrorStatusCodeMatcher(400..<430)\n        let error = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: 412))\n        XCTAssertTrue(matcher.matches(error))\n    }\n    \n    func testThatItDoesNotMatchErrorOutsideRange() {\n        let matcher = AFErrorStatusCodeMatcher(400..<430)\n        let error = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: 500))\n        XCTAssertFalse(matcher.matches(error))\n    }\n    \n    func testThatItDoesNotMatchAFErrorOfDifferentReason() {\n        let error = AFError.responseValidationFailed(reason: .dataFileNil)\n        let matcher = AFErrorStatusCodeMatcher(400..<500)\n        XCTAssertFalse(matcher.matches(error))\n    }\n    \n    func testThatItDoesntMatchOtherTypesOfAFErrorReasons() {\n        let error = AFError.parameterEncodingFailed(reason: .missingURL)\n        let matcher = AFErrorStatusCodeMatcher(400..<500)\n        XCTAssertFalse(matcher.matches(error))\n    }\n    \n    func testThatItDoesntMatchOtherTypesOfErrors() {\n        let error = NSError(domain: \"foo\", code: 9, userInfo: nil)\n        let matcher = AFErrorStatusCodeMatcher(400..<500)\n        XCTAssertFalse(matcher.matches(error))\n    }\n}\n"
  },
  {
    "path": "Example/Tests/ClosureErrorMatcherTests.swift",
    "content": "//\n//  ClosureMatcherTests.swift\n//  ErrorHandler-iOS Tests\n//\n//  Created by Kostas Kremizas on 02/08/2017.\n//  Copyright © 2017 Workable. All rights reserved.\n//\n\nimport XCTest\nimport ErrorHandler\n\nclass ClosureErrorMatcherTests: XCTestCase {\n    \n    func testThatClosureMatcherUsesClosureInInitialiser() {\n        \n        struct AnError: Error {}\n        let error = AnError()\n        let closure: (Error) -> Bool = { $0 is AnError }\n        \n        let sut = ClosureErrorMatcher(matches: closure)\n        XCTAssertEqual(closure(error), sut.matches(error))\n    }\n    \n}\n"
  },
  {
    "path": "Example/Tests/ErrorHandler-AFExtensionsTests.swift",
    "content": "//\n//  ErrorHandler-AFExtensionsTests.swift\n//  Workable SA\n//\n//  Created by Kostas Kremizas on 01/09/2017.\n//  Copyright © 2017 Workable SA. All rights reserved.\n//\n\nimport Foundation\nimport XCTest\nimport Alamofire\nimport ErrorHandler\n\nclass ErrorHandlerAFExtensionsTests: XCTestCase {\n    \n    func testThatItMatchesErrorWithSameStatus() {\n        let code = 404\n        let error = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: code))\n        let actionCalled = expectation(description: \"Do action was called\")\n\n        \n        ErrorHandler()\n            .onAFError(withStatus: 404) { (_) -> MatchingPolicy in\n                actionCalled.fulfill()\n                return .continueMatching\n            }\n            .handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n    }\n    \n    func testThatItDoesntMatchErrorWithOtherStatus() {\n        let error = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: 400))\n        let timeout = expectation(description: \"Timeout for action to be called has passed\")\n        var actionCalled = false\n        \n        ErrorHandler()\n            .onAFError(withStatus: 404) { (error) -> MatchingPolicy in\n                actionCalled = true\n                return .continueMatching\n            }.handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            timeout.fulfill()\n        }\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertFalse(actionCalled)\n    }\n    \n    func testThatItMatchesErrorInCorrectRange() {\n        let code = 404\n        let error = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: code))\n        let actionCalled = expectation(description: \"Do action was called\")\n        \n        \n        ErrorHandler()\n            .onAFError(withStatus: 400..<500) { (_) -> MatchingPolicy in\n                actionCalled.fulfill()\n                return .continueMatching\n            }\n            .handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n    }\n    \n    func testThatItDoesNotMatchErrorOutsideRange() {\n        let error = AFError.responseValidationFailed(reason: .unacceptableStatusCode(code: 500))\n        let timeout = expectation(description: \"Timeout for action to be called has passed\")\n        var actionCalled = false\n        \n        ErrorHandler()\n            .onAFError(withStatus: 400..<430) { (error) -> MatchingPolicy in\n                actionCalled = true\n                return .continueMatching\n            }.handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            timeout.fulfill()\n        }\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertFalse(actionCalled)\n    }\n    \n    func testThatItDoesNotMatchAFErrorOfDifferentReason() {\n        let error = AFError.responseValidationFailed(reason: .dataFileNil)\n        let timeout = expectation(description: \"Timeout for action to be called has passed\")\n        var actionCalled = false\n        \n        ErrorHandler()\n            .onAFError(withStatus: 400..<430) { (error) -> MatchingPolicy in\n                actionCalled = true\n                return .continueMatching\n            }.handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            timeout.fulfill()\n        }\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertFalse(actionCalled)\n    }\n    \n    func testThatItDoesntMatchOtherTypesOfAFErrorReasons() {\n        let error = AFError.parameterEncodingFailed(reason: .missingURL)\n        \n        let timeout = expectation(description: \"Timeout for action to be called has passed\")\n        var actionCalled = false\n        \n        ErrorHandler()\n            .onAFError(withStatus: 400..<430) { (error) -> MatchingPolicy in\n                actionCalled = true\n                return .continueMatching\n            }.handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            timeout.fulfill()\n        }\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertFalse(actionCalled)\n    }\n    \n    func testThatItDoesntMatchOtherTypesOfErrors() {\n        let error = NSError(domain: \"foo\", code: 9, userInfo: nil)\n\n        \n        let timeout = expectation(description: \"Timeout for action to be called has passed\")\n        var actionCalled = false\n        \n        ErrorHandler()\n            .onAFError(withStatus: 400..<430) { (error) -> MatchingPolicy in\n                actionCalled = true\n                return .continueMatching\n            }.handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            timeout.fulfill()\n        }\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertFalse(actionCalled)\n    }\n}\n"
  },
  {
    "path": "Example/Tests/ErrorHandlerTests.swift",
    "content": "//\n//  ErrorHandlerTests.swift\n//  Workable\n//\n//  Created by Kostas Kremizas on 25/07/2017.\n//  Copyright © 2017 Workable. All rights reserved.\n//\n\nimport Foundation\nimport XCTest\nimport ErrorHandler\n\nclass ErrorHandlerTests: XCTestCase {\n    \n    class AnError: Error {}\n    \n    func testThatTheActionIsCalledOnAMatch() {\n        \n        let error = AnError()\n        \n        let actionCalled = expectation(description: \"Do action was called\")\n        \n        var errorInCallBack: Error?\n        ErrorHandler()\n            .on(matches: { _ in true }) { (error) -> MatchingPolicy in\n                actionCalled.fulfill()\n                errorInCallBack = error\n                return .continueMatching\n        }.handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertTrue(errorInCallBack is AnError)\n    }\n    \n    func testThatTheActionIsNotCalledWhenThereIsNoMatch() {\n        \n        let error = AnError()\n        let timeout = expectation(description: \"Timeout for action to be called has passed\")\n        var actionCalled = false\n        \n        ErrorHandler()\n            .on(matches: { _ in false }) { (error) -> MatchingPolicy in\n                actionCalled = true\n                return .continueMatching\n            }.handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            timeout.fulfill()\n        }\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertFalse(actionCalled)\n    }\n    \n    func testThatOnNoMatchIsCalledWhenThereIsNoMatch() {\n        \n        let error = AnError()\n        let actionCalled = expectation(description: \"On no match action was called\")\n        var errorInCallBack: Error?\n        \n        ErrorHandler()\n            .onNoMatch(do: { (error) -> MatchingPolicy in\n                actionCalled.fulfill()\n                errorInCallBack = error\n                return .continueMatching\n            }).handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertTrue(errorInCallBack is AnError)\n    }\n    \n    func testThatOnNoMatchIsNotCalledWhenThereIsAMatch() {\n        \n        let error = AnError()\n        let timeout = expectation(description: \"Timeout for on no match action to be called has passed\")\n        var actionCalled = false\n        \n        ErrorHandler()\n            .on(matches: { _ in true }, do: { _ in .continueMatching })\n            .onNoMatch(do: { (_) -> MatchingPolicy in\n                actionCalled = true\n                return .continueMatching\n            })\n            .handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            timeout.fulfill()\n        }\n        \n        waitForExpectations(timeout: 1.5)\n        \n        XCTAssertFalse(actionCalled)\n    }\n    \n    func testOnNomatchWithStopMatching() {\n        let error = AnError()\n        let timeout = expectation(description: \"Timeout for on no match action1\")\n        var action1Called = false\n        let action2 = expectation(description: \"Action 2 called\")\n        \n        ErrorHandler()\n            .onNoMatch(do: { (_) -> MatchingPolicy in\n                action1Called = true\n                return .continueMatching\n            })\n            .onNoMatch(do: { (_) -> MatchingPolicy in\n                action2.fulfill()\n                return .stopMatching\n            })\n            .handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            timeout.fulfill()\n        }\n        \n        waitForExpectations(timeout: 1.5)\n        \n        XCTAssertFalse(action1Called)\n    }\n    \n    func testThatAlwaysActionIsCalledIfThereIsAMatch() {\n        let error = AnError()\n        let actionCalled = expectation(description: \"Always was called\")\n        var errorInCallBack: Error?\n        \n        ErrorHandler()\n            .on(matches: { _ in return true }, do: { _ in .stopMatching })\n            .always(do: { (error) -> MatchingPolicy in\n                errorInCallBack = error\n                actionCalled.fulfill()\n                return .continueMatching\n            })\n            .handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertTrue(errorInCallBack is AnError)\n    }\n    \n    func testThatAlwaysActionIsCalledIfThereIsNoMatch() {\n        let error = AnError()\n        let actionCalled = expectation(description: \"Always was called\")\n        var errorInCallBack: Error?\n        \n        ErrorHandler()\n            .on(matches: { _ in return false }, do: { _ in .stopMatching })\n            .always(do: { (error) -> MatchingPolicy in\n                errorInCallBack = error\n                actionCalled.fulfill()\n                return .continueMatching\n            })\n            .handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertTrue(errorInCallBack is AnError)\n    }\n    \n    func testThatActionsGetCalledInFifoOrder() {\n        let error = AnError()\n        let action1 = expectation(description: \"Action1 was called\")\n        let action2 = expectation(description: \"Action2 was called\")\n\n        ErrorHandler()\n            .on(matches: { _ in return true }, do: { (_) -> MatchingPolicy in\n                action1.fulfill()\n                return .continueMatching\n            })\n            .on(matches: { _ in return true }, do: { (_) -> MatchingPolicy in\n                action2.fulfill()\n                return .continueMatching\n            })\n            .handle(error)\n        \n        wait(for: [action2, action1], timeout: 1.0, enforceOrder: true)\n    }\n    \n    func testThatMatchingStopsIfRequested() {\n        let error = AnError()\n        let action2 = expectation(description: \"Action1 was called\")\n        let action1Timeout = expectation(description: \"Timeout for action2 reached\")\n        var action1Called = false\n        \n        ErrorHandler()\n            .on(matches: { _ in return true }, do: { (_) -> MatchingPolicy in\n                action1Called = true\n                return .continueMatching\n            })\n            .on(matches: { _ in return true }, do: { (_) -> MatchingPolicy in\n                action2.fulfill()\n                return .stopMatching\n            })\n            .handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            action1Timeout.fulfill()\n        }\n        \n        wait(for: [action2, action1Timeout], timeout: 1.5, enforceOrder: true)\n        XCTAssertFalse(action1Called, \"Action after a mathing action that should stop matching was called.\")\n    }\n    \n    func testFullCase() {\n        let error = AnError()\n        \n        let action1Timeout = expectation(description: \"Timeout for action1 reached\")\n        var action1Called = false\n        let action2 = expectation(description: \"Action2 was called\")\n        let action3 = expectation(description: \"Action3 was called\")\n        let action4Timeout = expectation(description: \"Timeout for action1 reached\")\n        var action4Called = false\n        let onNoMatchTimeout = expectation(description: \"Timeout for on no match reached\")\n        var onNoMatchCalled = false\n        let always1Timeout = expectation(description: \"Timeout for always1 reached\")\n        var always1Called = false\n        let always2 = expectation(description: \"Always2 was called\")\n        let always3 = expectation(description: \"Always3 was called\")\n        \n        ErrorHandler()\n            .on(matches: { _ in true }, do: { _ in\n                action1Called = true\n                return .continueMatching\n            })\n            .on(matches: { _ in return true }, do: { (_) -> MatchingPolicy in\n                action2.fulfill()\n                return .stopMatching\n            })\n            .on(matches: { _ in return true }, do: { (_) -> MatchingPolicy in\n                action3.fulfill()\n                return .continueMatching\n            })\n            .on(matches: { _ in false }, do: { _ in\n                action4Called = true\n                return .stopMatching\n            })\n            .onNoMatch(do: { (_) -> MatchingPolicy in\n                onNoMatchCalled = true\n                return .continueMatching\n            })\n            .always(do: { (_) -> MatchingPolicy in\n                always1Called = true\n                return .stopMatching\n            })\n            .always(do: { (_) -> MatchingPolicy in\n                always2.fulfill()\n                return .stopMatching\n            })\n            .always(do: { (_) -> MatchingPolicy in\n                always3.fulfill()\n                return .continueMatching\n            })\n            .handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            action1Timeout.fulfill()\n            action4Timeout.fulfill()\n            onNoMatchTimeout.fulfill()\n            always1Timeout.fulfill()\n        }\n        \n        wait(for: [action3, action2, always3, always2], timeout: 1.5, enforceOrder: true)\n        \n        waitForExpectations(timeout: 1.5)\n        XCTAssertFalse(action1Called, \"Action after a mathing action that should stop matching was called.\")\n        XCTAssertFalse(action4Called, \"Action that doesn't match was called.\")\n        XCTAssertFalse(onNoMatchCalled, \"On no match action called even though there are matches.\")\n        XCTAssertFalse(always1Called, \"Always action after a mathing always action that should stop matching was called.\")\n    }\n    \n    func testOnMatcherVariation() {\n        \n        struct CustomError: Error {}\n        \n        let error = CustomError()\n        let actionCalled = expectation(description: \"Action called\")\n        var errorInCallback: Error?\n        \n        ErrorHandler()\n            .on(ErrorTypeMatcher<CustomError>()) { (error) -> MatchingPolicy in\n                actionCalled.fulfill()\n                errorInCallback = error\n                return .continueMatching\n        }.handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n        \n        XCTAssertTrue(errorInCallback is CustomError)\n    }\n    \n    func testOnErrorOfType() {\n        \n        let error = AnError()\n        let actionCalled = expectation(description: \"Action called\")\n        var errorInCallback: Error?\n        \n        ErrorHandler()\n            .onError(ofType: AnError.self, do: { (error) -> MatchingPolicy in\n                actionCalled.fulfill()\n                errorInCallback = error\n                return .continueMatching\n            })\n            .handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n        XCTAssertTrue(errorInCallback is AnError)\n    }\n    \n    func testTaggingMatcher() {\n        let error = AnError()\n        let actionCalled = expectation(description: \"Action called\")\n        var errorInCallback: Error?\n        \n        ErrorHandler()\n            .tag(ErrorTypeMatcher<AnError>(), with: \"AnError\")\n            .on(tag: \"AnError\") { (error) -> MatchingPolicy in\n                actionCalled.fulfill()\n                errorInCallback = error\n                return .continueMatching\n            }.handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n        XCTAssertTrue(errorInCallback is AnError)\n    }\n    \n    func testTaggingWhenTheTagAlreadyExists() {\n        \n        struct InvalidStateError: Error {}\n        struct BadDataError: Error {}\n        \n        let error = InvalidStateError()\n        let actionCalled = expectation(description: \"Action called\")\n        \n        ErrorHandler()\n            .tag(ErrorTypeMatcher<BadDataError>(), with: \"CustomError\")\n            .tag(ErrorTypeMatcher<InvalidStateError>(), with: \"CustomError\")\n            .on(tag: \"CustomError\") { (_) -> MatchingPolicy in\n                actionCalled.fulfill()\n                return .continueMatching\n            }.handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n    }\n    \n    func testTaggingMatchesFunction() {\n        let error = AnError()\n        let actionCalled = expectation(description: \"Action called\")\n        var errorInCallback: Error?\n        \n        ErrorHandler()\n            .tag(matches: { $0 is AnError }, with: \"AnError\")\n            .on(tag: \"AnError\") { (error) -> MatchingPolicy in\n                actionCalled.fulfill()\n                errorInCallback = error\n                return .continueMatching\n            }.handle(error)\n        \n        waitForExpectations(timeout: 1.0)\n        XCTAssertTrue(errorInCallback is AnError)\n    }\n    \n    func testOnTagWithNoExistingMatcherDoesNothing() {\n        let error = AnError()\n        let actionTimeout = expectation(description: \"Action called\")\n        var actionCalled = false\n        \n        ErrorHandler()\n            .tag(matches: { $0 is AnError }, with: \"AnError\")\n            .on(tag: \"CustomError\") { (_) -> MatchingPolicy in\n                actionCalled = true\n                return .continueMatching\n            }.handle(error)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {\n            actionTimeout.fulfill()\n        }\n        waitForExpectations(timeout: 1.2)\n        XCTAssertFalse(actionCalled)\n    }\n    \n    func testOnEquatableError() {\n        \n        enum ValidationError: Error {\n            case invalidEmail\n            case invalidPassword\n        }\n        \n        let invalidEmailActionCalled = expectation(description: \"Invalid email action called\")\n        let invalidPasswordTimeoutReached = expectation(description: \"Invalid password cation not called\")\n        var invalidPasswordActionCalled = false\n        \n        ErrorHandler()\n            .on(ValidationError.invalidEmail, do: { (_) -> MatchingPolicy in\n                invalidEmailActionCalled.fulfill()\n                return .continueMatching\n            })\n            .on(ValidationError.invalidPassword, do: { (_) -> MatchingPolicy in\n                invalidPasswordActionCalled = true\n                return .continueMatching\n            })\n            .handle(ValidationError.invalidEmail)\n        \n        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {\n            invalidPasswordTimeoutReached.fulfill()\n        }\n        waitForExpectations(timeout: 1.2)\n\n        XCTAssertFalse(invalidPasswordActionCalled)\n    }\n}\n"
  },
  {
    "path": "Example/Tests/ErrorTypeMatcherTests.swift",
    "content": "//\n//  ErrorTypeMatcherTests.swift\n//  ErrorHandler-iOS Tests\n//\n//  Created by Kostas Kremizas on 25/07/2017.\n//  Copyright © 2017 Workable. All rights reserved.\n//\n\nimport XCTest\nimport ErrorHandler\n\nclass ErrorTypeMatcherTests: XCTestCase {\n    \n    func testThatErrorTypeMatcherMatchesErrorOfSameType() {\n        \n        // Arrange\n        struct CustomError: Error {}\n        let sut = ErrorTypeMatcher<CustomError>()\n        let error: Error = CustomError()\n        \n        // Act - Assert\n        XCTAssertTrue(sut.matches(error))\n    }\n    \n    func testThatErrorTypeMatcherDoesNotMatchErrorOfDifferentType() {\n        \n        // Arrange\n        struct CustomError: Error {}\n        let sut = ErrorTypeMatcher<CustomError>()\n        \n        struct AnotherCustomError: Error {}\n        let error: Error = AnotherCustomError()\n        \n        // Act - Assert\n        XCTAssertFalse(sut.matches(error))\n    }\n}\n"
  },
  {
    "path": "Example/Tests/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>$(PRODUCT_NAME)</string>\n\t<key>CFBundlePackageType</key>\n\t<string>BNDL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "Example/Tests/NSErrorMatcherTests.swift",
    "content": "//\n//  NSErrorMatcherTests.swift\n//  ErrorHandler-iOS\n//\n//  Created by Eleni Papanikolopoulou on 05/08/2017.\n//  Copyright © 2017 Workable. All rights reserved.\n//\n\nimport XCTest\nimport ErrorHandler\n\nclass NSErrorMatcherTests: XCTestCase {\n\n    func testThatItMatchesNsErrorsWithSameDomainAndCode() {\n\n        // Arrange\n        let domain = \"test_domain\"\n        let nsError = NSError(domain: domain, code: 1, userInfo: nil)\n        let sut = NSErrorMatcher(domain: domain, code: 1)\n\n        // Act - Assert\n        XCTAssertTrue(sut.matches(nsError))\n    }\n\n    func testThatItDoesNotMatchErrorsOfDifferentType() {\n        // Arrange\n        let nsError = NSError(domain: \"test_domain\", code: 1, userInfo: nil)\n        let sut = NSErrorMatcher(domain: \"different_domain\", code: 1)\n\n        // Act - Assert\n        XCTAssertFalse(sut.matches(nsError))\n    }\n    \n    func testThatItMatchesNsErrorsWithSameDomainIfCodeIsNill() {\n        // Arrange\n        let domain = \"test_domain\"\n        let nsError = NSError(domain: domain, code: 3, userInfo: nil)\n        let sut = NSErrorMatcher(domain: domain, code: nil)\n        \n        //Act - Assert\n        XCTAssertTrue(sut.matches(nsError))\n    }\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) 2017 Workable SA\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "Package.swift",
    "content": "// swift-tools-version:5.1\nimport PackageDescription\n\nlet package = Package(\n    name: \"ErrorHandler\",\n    platforms: [\n        .iOS(.v10),\n        .macOS(.v10_12),\n        .watchOS(.v3),\n        .tvOS(.v10)\n    ],\n    products: [\n        .library(\n            name: \"ErrorHandler\",\n            targets: [\"ErrorHandler\"]),\n    ],\n    dependencies: [\n         .package(url: \"https://github.com/Alamofire/Alamofire.git\", .upToNextMajor(from: \"5.0.0\"))\n    ],\n    targets: [\n        .target(name: \"ErrorHandler\", dependencies: [\"Alamofire\"], path: \"./ErrorHandler\"),\n        .testTarget(name: \"ErrorHandlerTests\", dependencies: [\"ErrorHandler\"], path: \"./Example/Tests\")\n    ],\n    swiftLanguageVersions: [.v4_2, .v5]\n)\n"
  },
  {
    "path": "README.md",
    "content": "![Error Handler](https://github.com/Workable/swift-error-handler/blob/master/ErrorHandler.png)\n\n[![Travis](https://travis-ci.org/Workable/swift-error-handler.svg?branch=master)](https://travis-ci.org/Workable/swift-error-handler)\n\n> Elegant and flexible error handling for Swift\n\nErrorHandler enables expressing complex error handling logic with a few lines of code using a memorable fluent API.\n\n\n## Installation\n\n### CocoaPods\n\nTo integrate `ErrorHandler` into your Xcode project using CocoaPods, use the following entry in your `Podfile`:\n\n```ruby\ntarget '<Your Target Name>' do\n    pod 'ErrorHandler'\nend\n```\n\nor if you are using Alamofire and want to take advantage of the `ErrorHandler`s convenience extensions for handling `Alamofire` errors with  invalid http statuses\n\n\n```ruby\ntarget '<Your Target Name>' do\n    pod 'ErrorHandler'\n    pod 'ErrorHandler/Alamofire'\nend\n```\n\nThen, run the following command:\n\n```bash\n$ pod install\n```\n\n### Carthage\n\nTo integrate `ErrorHandler` into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"Workable/swift-error-handler\"\n```\n\nRun `carthage update` to build the framework and drag the built `ErrorHandler.framework` into your Xcode project.\n\n### Swift Package Manager\n\nTo integrate using Apple's Swift package manager, add the following as a dependency to your Package.swift:\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"MyApp\",\n    dependencies: [\n        .package(url: \"https://github.com/Workable/swift-error-handler.git\", from: \"0.8\")\n    ]\n)\n```\n\n\n## Usage\n\nLet's say we're building a messaging iOS app that uses both the network and a local database.\n\nWe need to:\n\n### Setup a default ErrorHandler once\n\nThe default ErrorHandler will contain the error handling logic that is common across your application and you don't want to duplicate. You can create a factory that creates it so that you can get new instance with the common handling logic from anywhere in your app.\n\n```swift\nextension ErrorHandler {\n    class var defaultHandler: ErrorHandler {\n\n        return ErrorHandler()\n\n            // Τhe error matches and the action is called if the matches closure returns true\n            .on(matches: { (error) -> Bool in\n                guard let error = error as? InvalidInputsError else { return false }\n                // we will ignore errors with code == 5\n                return error.code != 5\n            }, do: { (error) in\n                showErrorAlert(\"Invalid Inputs\")\n                return .continueMatching\n            })\n\n            // Variant using ErrorMatcher which is convenient if you want to\n            // share the same matching logic elsewhere\n            .on(InvalidStateMatcher(), do: { (_) in\n                showErrorAlert(\"An error has occurred. Please restart the app.\")\n                return .continueMatching\n            })\n\n            // Handle all errors of the same type the same way\n            .onError(ofType: ParsingError.self, do: { (error) in\n                doSomething(with: error)\n                return .continueMatching\n            })\n\n            // Handle a specific instance of an Equatable error type\n            .on(DBError.migrationNeeded, do: { (_) in\n                // Db.migrate()\n                return .continueMatching\n            })\n\n            // You can tag matchers or matches functions in order to reuse them with a more memorable alias.\n            // You can use the same tag for many matchers. This way you can group them and handle their errors together.\n            .tag(NSErrorMatcher(domain: NSURLErrorDomain, code: NSURLErrorNetworkConnectionLost),\n                with: \"ConnectionError\"\n            )\n            .tag(NSErrorMatcher(domain: NSURLErrorDomain, code: NSURLErrorNotConnectedToInternet),\n                with: \"ConnectionError\"\n            )\n            .on(tag: \"ConnectionError\") { (_) in\n                showErrorAlert(\"You are not connected to the Internet. Please check your connection and retry.\")\n                return .continueMatching\n            }\n\n            // You can use the Alamofire extensions to easily handle responses with invalid http status\n            .onAFError(withStatus: 401, do: { (_) in\n                showLoginScreen()\n                return .continueMatching\n            })\n            .onAFError(withStatus: 404, do: { (_) in\n                showErrorAlert(\"Resource not found!\")\n                return .continueMatching\n            })\n\n            // Handle unknown errors.\n            .onNoMatch(do: { (_)  in\n                showErrorAlert(\"An error occurred! Please try again. \")\n                return .continueMatching\n            })\n\n            // Add actions - like logging - that you want to perform each time - whether the error was matched or not\n            .always(do: { (error) in\n                Logger.log(error)\n                return .continueMatching\n            })\n    }\n}\n```\n### Use the default handler to handle common cases\n\nOften the cases the default handler knows about will be good enough.\n\n```swift\ndo {\n    try saveStatus()\n} catch {\n    ErrorHandler.defaultHandler.handle(error)\n}\n```\n\nor use the `tryWith` free function:\n\n```swift\ntryWith(ErrorHandler.defaultHandler) {\n    try saveStatus()\n}\n```\n### Customize the error handler when needed.\n\nIn cases where extra context is available you can add more cases or override the ones provided already.\n\nFor example in a SendMessageViewController\n\n```swift\nsendMessage(message) { (response, error) in\n\n            if let error = error {\n                ErrorHandler.defaultHandler\n                    .on(ValidationError.invalidEmail, do: { (_) in\n                        updateEmailTextFieldForValidationError()\n                        return .continueMatching\n                    })\n                    .onAFError(withStatus: 404, do: { (_) in\n                        doSomethingSpecificFor404()\n                        return .stopMatching\n                    })\n                    .onNoMatch(do: { (_) in\n                        // In the context of the current screen we can provide a better message.\n                        showErrorAlert(\"An error occurred! The message has not been sent.\")\n                        // We want to override the default onNoMatch handling so we stop searching for other matches.\n                        return .stopMatching\n                    })\n                    .handle(error)\n            }\n        }\n```\n\n\n## Why?\n\nWhen designing for errors, we usually need to:\n\n1. have a **default** handler for **expected** errors\n   // i.e. network, db errors etc.\n2. handle **specific** errors **in a custom manner** given **the context**  of where and when they occur\n   // i.e. network error while uploading a file, invalid login\n3. have a **catch-all** handler for **unknown** errors\n   // i.e. errors we don't have custom handling for\n4. perform some **actions** for **all errors** both known and unknown like logging\n5. keep our code **DRY**\n\nSwift's has a very well thought error handling model keeping balance between convenience ([automatic propagation](https://github.com/apple/swift/blob/master/docs/ErrorHandlingRationale.rst#automatic-propagation)) and clarity-safety ([Typed propagation](https://github.com/apple/swift/blob/master/docs/ErrorHandlingRationale.rst#id3), [Marked propagation](https://github.com/apple/swift/blob/master/docs/ErrorHandlingRationale.rst#id4)). As a result, the compiler serves as a reminder of errors that need to be handled and at the same type it is relatively easy to propagate errors and handle them higher up the stack.\n\nHowever, even with this help from the language, achieving the goals listed above in an **ad-hoc** manner in an application of a reasonable size can lead to a lot of **boilerplate** which is **tedious** to write and reason about. Because of this friction developers quite often choose to swallow errors or handle them all in the same generic way.\n\nThis library addresses these issues by providing an abstraction over defining flexible error handling rules with an opinionated fluent API.\n"
  }
]