瀏覽代碼

add codeformat(swiftformat)

wenweiwei 3 年之前
父節點
當前提交
4bf999376a
共有 36 個文件被更改,包括 2120 次插入1868 次删除
  1. 65 0
      .swiftformat
  2. 6 11
      Example/BFNetRequestKit/AppDelegate.swift
  3. 11 13
      Example/BFNetRequestKit/ViewController.swift
  4. 161 161
      Example/Pods/Alamofire/Source/AFError.swift
  5. 1 1
      Example/Pods/Alamofire/Source/Alamofire.swift
  6. 3 3
      Example/Pods/Alamofire/Source/AlamofireExtended.swift
  7. 2 1
      Example/Pods/Alamofire/Source/AuthenticationInterceptor.swift
  8. 2 1
      Example/Pods/Alamofire/Source/CachedResponseHandler.swift
  9. 540 521
      Example/Pods/Alamofire/Source/Combine.swift
  10. 114 98
      Example/Pods/Alamofire/Source/EventMonitor.swift
  11. 36 36
      Example/Pods/Alamofire/Source/HTTPHeaders.swift
  12. 20 18
      Example/Pods/Alamofire/Source/MultipartFormData.swift
  13. 2 1
      Example/Pods/Alamofire/Source/MultipartUpload.swift
  14. 200 199
      Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift
  15. 15 15
      Example/Pods/Alamofire/Source/Notifications.swift
  16. 2 1
      Example/Pods/Alamofire/Source/OperationQueue+Alamofire.swift
  17. 6 3
      Example/Pods/Alamofire/Source/ParameterEncoder.swift
  18. 4 3
      Example/Pods/Alamofire/Source/ParameterEncoding.swift
  19. 20 20
      Example/Pods/Alamofire/Source/Protected.swift
  20. 2 1
      Example/Pods/Alamofire/Source/RedirectHandler.swift
  21. 54 45
      Example/Pods/Alamofire/Source/Request.swift
  22. 15 10
      Example/Pods/Alamofire/Source/RequestInterceptor.swift
  23. 11 10
      Example/Pods/Alamofire/Source/RequestTaskMap.swift
  24. 18 15
      Example/Pods/Alamofire/Source/Response.swift
  25. 124 104
      Example/Pods/Alamofire/Source/ResponseSerialization.swift
  26. 11 8
      Example/Pods/Alamofire/Source/RetryPolicy.swift
  27. 467 465
      Example/Pods/Alamofire/Source/ServerTrustEvaluation.swift
  28. 44 22
      Example/Pods/Alamofire/Source/Session.swift
  29. 42 34
      Example/Pods/Alamofire/Source/SessionDelegate.swift
  30. 4 4
      Example/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift
  31. 17 11
      Example/Pods/Alamofire/Source/URLEncodedFormEncoder.swift
  32. 3 3
      Example/Pods/Alamofire/Source/URLRequest+Alamofire.swift
  33. 3 3
      Example/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift
  34. 23 20
      Example/Pods/Alamofire/Source/Validation.swift
  35. 5 7
      Example/Tests/Tests.swift
  36. 67 0
      rules.swiftformat

+ 65 - 0
.swiftformat

@@ -0,0 +1,65 @@
+--allman false
+--assetliterals visual-width
+--beforemarks 
+--binarygrouping none
+--categorymark "MARK: %c"
+--classthreshold 0
+--closingparen balanced
+--commas always
+--conflictmarkers reject
+--decimalgrouping none
+--elseposition same-line
+--enumthreshold 0
+--exponentcase lowercase
+--exponentgrouping disabled
+--extensionacl on-extension
+--extensionlength 0
+--extensionmark "MARK: - %t + %c"
+--fractiongrouping disabled
+--fragment false
+--funcattributes preserve
+--groupedextension "MARK: %c"
+--guardelse auto
+--header ignore
+--hexgrouping 4,8
+--hexliteralcase uppercase
+--ifdef indent
+--importgrouping alphabetized
+--indent 4
+--indentcase false
+--lifecycle 
+--linebreaks lf
+--markextensions always
+--marktypes always
+--maxwidth none
+--modifierorder 
+--nevertrailing 
+--nospaceoperators ...,..<
+--nowrapoperators 
+--octalgrouping none
+--operatorfunc spaced
+--organizetypes class,enum,struct
+--patternlet hoist
+--ranges spaced
+--redundanttype inferred
+--self remove
+--selfrequired 
+--semicolons inline
+--shortoptionals always
+--smarttabs enabled
+--stripunusedargs closure-only
+--structthreshold 0
+--tabwidth unspecified
+--trailingclosures 
+--trimwhitespace always
+--typeattributes preserve
+--typemark "MARK: - %t"
+--varattributes preserve
+--voidtype void
+--wraparguments preserve
+--wrapcollections preserve
+--wrapconditions preserve
+--wrapparameters preserve
+--wrapreturntype preserve
+--xcodeindentation disabled
+--yodaswap always

+ 6 - 11
Example/BFNetRequestKit/AppDelegate.swift

@@ -10,37 +10,32 @@ import UIKit
 
 
 @UIApplicationMain
 @UIApplicationMain
 class AppDelegate: UIResponder, UIApplicationDelegate {
 class AppDelegate: UIResponder, UIApplicationDelegate {
-
     var window: UIWindow?
     var window: UIWindow?
 
 
-
-    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
+    func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         // Override point for customization after application launch.
         // Override point for customization after application launch.
         return true
         return true
     }
     }
 
 
-    func applicationWillResignActive(_ application: UIApplication) {
+    func applicationWillResignActive(_: UIApplication) {
         // 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.
         // 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.
         // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
         // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
     }
     }
 
 
-    func applicationDidEnterBackground(_ application: UIApplication) {
+    func applicationDidEnterBackground(_: UIApplication) {
         // 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.
         // 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.
         // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
         // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
     }
     }
 
 
-    func applicationWillEnterForeground(_ application: UIApplication) {
+    func applicationWillEnterForeground(_: UIApplication) {
         // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
         // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
     }
     }
 
 
-    func applicationDidBecomeActive(_ application: UIApplication) {
+    func applicationDidBecomeActive(_: UIApplication) {
         // 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.
         // 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.
     }
     }
 
 
-    func applicationWillTerminate(_ application: UIApplication) {
+    func applicationWillTerminate(_: UIApplication) {
         // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
         // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
     }
     }
-
-
 }
 }
-

+ 11 - 13
Example/BFNetRequestKit/ViewController.swift

@@ -6,21 +6,19 @@
 //  Copyright (c) 2021 SanWCoder. All rights reserved.
 //  Copyright (c) 2021 SanWCoder. All rights reserved.
 //
 //
 
 
-import UIKit
 import BFNetRequestKit
 import BFNetRequestKit
+import UIKit
 
 
 class ViewController: UIViewController {
 class ViewController: UIViewController {
-
     override func viewDidLoad() {
     override func viewDidLoad() {
         super.viewDidLoad()
         super.viewDidLoad()
         // Do any additional setup after loading the view, typically from a nib.
         // Do any additional setup after loading the view, typically from a nib.
-        BFNetRequestAdaptor.postRequestData(url: "https://speed.piaoquantv.com/longvideoapi/video/distribute/category/videoList/v2", parames: ["categoryJson": "{\"categoryId\":55}", "pageNo": 1, "pageSize": 4, "sceneType": 1, "pageSource": "speedApp-category", "h5MsgVid": "", "cutBoard": "", "cutBoardInfo": ""],commonParams: commonParams()) { respose, extData, error, duration in
-            
+        BFNetRequestAdaptor.postRequestData(url: "https://speed.piaoquantv.com/longvideoapi/video/distribute/category/videoList/v2", parames: ["categoryJson": "{\"categoryId\":55}", "pageNo": 1, "pageSize": 4, "sceneType": 1, "pageSource": "speedApp-category", "h5MsgVid": "", "cutBoard": "", "cutBoardInfo": ""], commonParams: commonParams()) { _, _, _, _ in
         }
         }
-        BFNetRequestAdaptor.imageValideRequestData(url: "http://www.mxfjx.com/uploadfiles/2014/4/小鸡%20鸡蛋%20蛋生鸡%20鸡生蛋_conew1.gif") { data, respnse, error in
-            
+        BFNetRequestAdaptor.imageValideRequestData(url: "http://www.mxfjx.com/uploadfiles/2014/4/小鸡%20鸡蛋%20蛋生鸡%20鸡生蛋_conew1.gif") { _, _, _ in
         }
         }
     }
     }
+
     public func commonParams() -> [String: Any] {
     public func commonParams() -> [String: Any] {
         let model = UIDevice.current.model
         let model = UIDevice.current.model
         let systemName = UIDevice.current.systemName
         let systemName = UIDevice.current.systemName
@@ -35,7 +33,7 @@ class ViewController: UIViewController {
             "system": systemName + " " + systemVersion,
             "system": systemName + " " + systemVersion,
             "systemVersion": systemName + " " + systemVersion,
             "systemVersion": systemName + " " + systemVersion,
             "appType": 13,
             "appType": 13,
-            "appId": 111111,
+            "appId": 111_111,
             "machineCode": "43429BA1-6723-43B3-8B95-96782D289EA7",
             "machineCode": "43429BA1-6723-43B3-8B95-96782D289EA7",
             "networkType": SWNetRequest.networkStatusDescription(),
             "networkType": SWNetRequest.networkStatusDescription(),
             "ipAddress": SWNetRequest.ipAddressDescription(),
             "ipAddress": SWNetRequest.ipAddressDescription(),
@@ -43,19 +41,19 @@ class ViewController: UIViewController {
             "platform": "iOS",
             "platform": "iOS",
             "versionName": "2.6.6",
             "versionName": "2.6.6",
             "pageSource": "speedApp-category",
             "pageSource": "speedApp-category",
-    //        "sessionId": PQSingletoMemoryUtil.shared.sessionId,
-    //        "subSessionId": PQSingletoMemoryUtil.shared.subSessionid ?? PQSingletoMemoryUtil.shared.sessionId,
+            //        "sessionId": PQSingletoMemoryUtil.shared.sessionId,
+            //        "subSessionId": PQSingletoMemoryUtil.shared.subSessionid ?? PQSingletoMemoryUtil.shared.sessionId,
             "mid": "43429BA1-6723-43B3-8B95-96782D289EA7",
             "mid": "43429BA1-6723-43B3-8B95-96782D289EA7",
             "machineInfo": "",
             "machineInfo": "",
-    //        "abInfoData": dictionaryToJsonString(PQSingletoMemoryUtil.shared.abInfoData) ?? "",
+            //        "abInfoData": dictionaryToJsonString(PQSingletoMemoryUtil.shared.abInfoData) ?? "",
             "requestId": "423232323232323",
             "requestId": "423232323232323",
-            "idfv": UIDevice.current.identifierForVendor?.uuidString ?? ""]
+            "idfv": UIDevice.current.identifierForVendor?.uuidString ?? "",
+        ]
         return commParams
         return commParams
     }
     }
+
     override func didReceiveMemoryWarning() {
     override func didReceiveMemoryWarning() {
         super.didReceiveMemoryWarning()
         super.didReceiveMemoryWarning()
         // Dispose of any resources that can be recreated.
         // Dispose of any resources that can be recreated.
     }
     }
-
 }
 }
-

+ 161 - 161
Example/Pods/Alamofire/Source/AFError.swift

@@ -130,55 +130,55 @@ public enum AFError: Error {
     }
     }
 
 
     #if !(os(Linux) || os(Windows))
     #if !(os(Linux) || os(Windows))
-    /// Underlying reason a server trust evaluation error occurred.
-    public enum ServerTrustFailureReason {
-        /// The output of a server trust evaluation.
-        public struct Output {
-            /// The host for which the evaluation was performed.
-            public let host: String
-            /// The `SecTrust` value which was evaluated.
-            public let trust: SecTrust
-            /// The `OSStatus` of evaluation operation.
-            public let status: OSStatus
-            /// The result of the evaluation operation.
-            public let result: SecTrustResultType
-
-            /// Creates an `Output` value from the provided values.
-            init(_ host: String, _ trust: SecTrust, _ status: OSStatus, _ result: SecTrustResultType) {
-                self.host = host
-                self.trust = trust
-                self.status = status
-                self.result = result
+        /// Underlying reason a server trust evaluation error occurred.
+        public enum ServerTrustFailureReason {
+            /// The output of a server trust evaluation.
+            public struct Output {
+                /// The host for which the evaluation was performed.
+                public let host: String
+                /// The `SecTrust` value which was evaluated.
+                public let trust: SecTrust
+                /// The `OSStatus` of evaluation operation.
+                public let status: OSStatus
+                /// The result of the evaluation operation.
+                public let result: SecTrustResultType
+
+                /// Creates an `Output` value from the provided values.
+                init(_ host: String, _ trust: SecTrust, _ status: OSStatus, _ result: SecTrustResultType) {
+                    self.host = host
+                    self.trust = trust
+                    self.status = status
+                    self.result = result
+                }
             }
             }
-        }
 
 
-        /// No `ServerTrustEvaluator` was found for the associated host.
-        case noRequiredEvaluator(host: String)
-        /// No certificates were found with which to perform the trust evaluation.
-        case noCertificatesFound
-        /// No public keys were found with which to perform the trust evaluation.
-        case noPublicKeysFound
-        /// During evaluation, application of the associated `SecPolicy` failed.
-        case policyApplicationFailed(trust: SecTrust, policy: SecPolicy, status: OSStatus)
-        /// During evaluation, setting the associated anchor certificates failed.
-        case settingAnchorCertificatesFailed(status: OSStatus, certificates: [SecCertificate])
-        /// During evaluation, creation of the revocation policy failed.
-        case revocationPolicyCreationFailed
-        /// `SecTrust` evaluation failed with the associated `Error`, if one was produced.
-        case trustEvaluationFailed(error: Error?)
-        /// Default evaluation failed with the associated `Output`.
-        case defaultEvaluationFailed(output: Output)
-        /// Host validation failed with the associated `Output`.
-        case hostValidationFailed(output: Output)
-        /// Revocation check failed with the associated `Output` and options.
-        case revocationCheckFailed(output: Output, options: RevocationTrustEvaluator.Options)
-        /// Certificate pinning failed.
-        case certificatePinningFailed(host: String, trust: SecTrust, pinnedCertificates: [SecCertificate], serverCertificates: [SecCertificate])
-        /// Public key pinning failed.
-        case publicKeyPinningFailed(host: String, trust: SecTrust, pinnedKeys: [SecKey], serverKeys: [SecKey])
-        /// Custom server trust evaluation failed due to the associated `Error`.
-        case customEvaluationFailed(error: Error)
-    }
+            /// No `ServerTrustEvaluator` was found for the associated host.
+            case noRequiredEvaluator(host: String)
+            /// No certificates were found with which to perform the trust evaluation.
+            case noCertificatesFound
+            /// No public keys were found with which to perform the trust evaluation.
+            case noPublicKeysFound
+            /// During evaluation, application of the associated `SecPolicy` failed.
+            case policyApplicationFailed(trust: SecTrust, policy: SecPolicy, status: OSStatus)
+            /// During evaluation, setting the associated anchor certificates failed.
+            case settingAnchorCertificatesFailed(status: OSStatus, certificates: [SecCertificate])
+            /// During evaluation, creation of the revocation policy failed.
+            case revocationPolicyCreationFailed
+            /// `SecTrust` evaluation failed with the associated `Error`, if one was produced.
+            case trustEvaluationFailed(error: Error?)
+            /// Default evaluation failed with the associated `Output`.
+            case defaultEvaluationFailed(output: Output)
+            /// Host validation failed with the associated `Output`.
+            case hostValidationFailed(output: Output)
+            /// Revocation check failed with the associated `Output` and options.
+            case revocationCheckFailed(output: Output, options: RevocationTrustEvaluator.Options)
+            /// Certificate pinning failed.
+            case certificatePinningFailed(host: String, trust: SecTrust, pinnedCertificates: [SecCertificate], serverCertificates: [SecCertificate])
+            /// Public key pinning failed.
+            case publicKeyPinningFailed(host: String, trust: SecTrust, pinnedKeys: [SecKey], serverKeys: [SecKey])
+            /// Custom server trust evaluation failed due to the associated `Error`.
+            case customEvaluationFailed(error: Error)
+        }
     #endif
     #endif
 
 
     /// The underlying reason the `.urlRequestValidationFailed`
     /// The underlying reason the `.urlRequestValidationFailed`
@@ -212,8 +212,8 @@ public enum AFError: Error {
     /// Response serialization failed.
     /// Response serialization failed.
     case responseSerializationFailed(reason: ResponseSerializationFailureReason)
     case responseSerializationFailed(reason: ResponseSerializationFailureReason)
     #if !(os(Linux) || os(Windows))
     #if !(os(Linux) || os(Windows))
-    /// `ServerTrustEvaluating` instance threw an error during trust evaluation.
-    case serverTrustEvaluationFailed(reason: ServerTrustFailureReason)
+        /// `ServerTrustEvaluating` instance threw an error during trust evaluation.
+        case serverTrustEvaluationFailed(reason: ServerTrustFailureReason)
     #endif
     #endif
     /// `Session` which issued the `Request` was deinitialized, most likely because its reference went out of scope.
     /// `Session` which issued the `Request` was deinitialized, most likely because its reference went out of scope.
     case sessionDeinitialized
     case sessionDeinitialized
@@ -225,14 +225,14 @@ public enum AFError: Error {
     case urlRequestValidationFailed(reason: URLRequestValidationFailureReason)
     case urlRequestValidationFailed(reason: URLRequestValidationFailureReason)
 }
 }
 
 
-extension Error {
+public extension Error {
     /// Returns the instance cast as an `AFError`.
     /// Returns the instance cast as an `AFError`.
-    public var asAFError: AFError? {
+    var asAFError: AFError? {
         self as? AFError
         self as? AFError
     }
     }
 
 
     /// Returns the instance cast as an `AFError`. If casting fails, a `fatalError` with the specified `message` is thrown.
     /// Returns the instance cast as an `AFError`. If casting fails, a `fatalError` with the specified `message` is thrown.
-    public func asAFError(orFailWith message: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> AFError {
+    func asAFError(orFailWith message: @autoclosure () -> String, file: StaticString = #file, line: UInt = #line) -> AFError {
         guard let afError = self as? AFError else {
         guard let afError = self as? AFError else {
             fatalError(message(), file: file, line: line)
             fatalError(message(), file: file, line: line)
         }
         }
@@ -240,120 +240,120 @@ extension Error {
     }
     }
 
 
     /// Casts the instance as `AFError` or returns `defaultAFError`
     /// Casts the instance as `AFError` or returns `defaultAFError`
-    func asAFError(or defaultAFError: @autoclosure () -> AFError) -> AFError {
+    internal func asAFError(or defaultAFError: @autoclosure () -> AFError) -> AFError {
         self as? AFError ?? defaultAFError()
         self as? AFError ?? defaultAFError()
     }
     }
 }
 }
 
 
 // MARK: - Error Booleans
 // MARK: - Error Booleans
 
 
-extension AFError {
+public extension AFError {
     /// Returns whether the instance is `.sessionDeinitialized`.
     /// Returns whether the instance is `.sessionDeinitialized`.
-    public var isSessionDeinitializedError: Bool {
+    var isSessionDeinitializedError: Bool {
         if case .sessionDeinitialized = self { return true }
         if case .sessionDeinitialized = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `.sessionInvalidated`.
     /// Returns whether the instance is `.sessionInvalidated`.
-    public var isSessionInvalidatedError: Bool {
+    var isSessionInvalidatedError: Bool {
         if case .sessionInvalidated = self { return true }
         if case .sessionInvalidated = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `.explicitlyCancelled`.
     /// Returns whether the instance is `.explicitlyCancelled`.
-    public var isExplicitlyCancelledError: Bool {
+    var isExplicitlyCancelledError: Bool {
         if case .explicitlyCancelled = self { return true }
         if case .explicitlyCancelled = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `.invalidURL`.
     /// Returns whether the instance is `.invalidURL`.
-    public var isInvalidURLError: Bool {
+    var isInvalidURLError: Bool {
         if case .invalidURL = self { return true }
         if case .invalidURL = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `.parameterEncodingFailed`. When `true`, the `underlyingError` property will
     /// Returns whether the instance is `.parameterEncodingFailed`. When `true`, the `underlyingError` property will
     /// contain the associated value.
     /// contain the associated value.
-    public var isParameterEncodingError: Bool {
+    var isParameterEncodingError: Bool {
         if case .parameterEncodingFailed = self { return true }
         if case .parameterEncodingFailed = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `.parameterEncoderFailed`. When `true`, the `underlyingError` property will
     /// Returns whether the instance is `.parameterEncoderFailed`. When `true`, the `underlyingError` property will
     /// contain the associated value.
     /// contain the associated value.
-    public var isParameterEncoderError: Bool {
+    var isParameterEncoderError: Bool {
         if case .parameterEncoderFailed = self { return true }
         if case .parameterEncoderFailed = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `.multipartEncodingFailed`. When `true`, the `url` and `underlyingError`
     /// Returns whether the instance is `.multipartEncodingFailed`. When `true`, the `url` and `underlyingError`
     /// properties will contain the associated values.
     /// properties will contain the associated values.
-    public var isMultipartEncodingError: Bool {
+    var isMultipartEncodingError: Bool {
         if case .multipartEncodingFailed = self { return true }
         if case .multipartEncodingFailed = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `.requestAdaptationFailed`. When `true`, the `underlyingError` property will
     /// Returns whether the instance is `.requestAdaptationFailed`. When `true`, the `underlyingError` property will
     /// contain the associated value.
     /// contain the associated value.
-    public var isRequestAdaptationError: Bool {
+    var isRequestAdaptationError: Bool {
         if case .requestAdaptationFailed = self { return true }
         if case .requestAdaptationFailed = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `.responseValidationFailed`. When `true`, the `acceptableContentTypes`,
     /// Returns whether the instance is `.responseValidationFailed`. When `true`, the `acceptableContentTypes`,
     /// `responseContentType`,  `responseCode`, and `underlyingError` properties will contain the associated values.
     /// `responseContentType`,  `responseCode`, and `underlyingError` properties will contain the associated values.
-    public var isResponseValidationError: Bool {
+    var isResponseValidationError: Bool {
         if case .responseValidationFailed = self { return true }
         if case .responseValidationFailed = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `.responseSerializationFailed`. When `true`, the `failedStringEncoding` and
     /// Returns whether the instance is `.responseSerializationFailed`. When `true`, the `failedStringEncoding` and
     /// `underlyingError` properties will contain the associated values.
     /// `underlyingError` properties will contain the associated values.
-    public var isResponseSerializationError: Bool {
+    var isResponseSerializationError: Bool {
         if case .responseSerializationFailed = self { return true }
         if case .responseSerializationFailed = self { return true }
         return false
         return false
     }
     }
 
 
     #if !(os(Linux) || os(Windows))
     #if !(os(Linux) || os(Windows))
-    /// Returns whether the instance is `.serverTrustEvaluationFailed`. When `true`, the `underlyingError` property will
-    /// contain the associated value.
-    public var isServerTrustEvaluationError: Bool {
-        if case .serverTrustEvaluationFailed = self { return true }
-        return false
-    }
+        /// Returns whether the instance is `.serverTrustEvaluationFailed`. When `true`, the `underlyingError` property will
+        /// contain the associated value.
+        var isServerTrustEvaluationError: Bool {
+            if case .serverTrustEvaluationFailed = self { return true }
+            return false
+        }
     #endif
     #endif
 
 
     /// Returns whether the instance is `requestRetryFailed`. When `true`, the `underlyingError` property will
     /// Returns whether the instance is `requestRetryFailed`. When `true`, the `underlyingError` property will
     /// contain the associated value.
     /// contain the associated value.
-    public var isRequestRetryError: Bool {
+    var isRequestRetryError: Bool {
         if case .requestRetryFailed = self { return true }
         if case .requestRetryFailed = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `createUploadableFailed`. When `true`, the `underlyingError` property will
     /// Returns whether the instance is `createUploadableFailed`. When `true`, the `underlyingError` property will
     /// contain the associated value.
     /// contain the associated value.
-    public var isCreateUploadableError: Bool {
+    var isCreateUploadableError: Bool {
         if case .createUploadableFailed = self { return true }
         if case .createUploadableFailed = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `createURLRequestFailed`. When `true`, the `underlyingError` property will
     /// Returns whether the instance is `createURLRequestFailed`. When `true`, the `underlyingError` property will
     /// contain the associated value.
     /// contain the associated value.
-    public var isCreateURLRequestError: Bool {
+    var isCreateURLRequestError: Bool {
         if case .createURLRequestFailed = self { return true }
         if case .createURLRequestFailed = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `downloadedFileMoveFailed`. When `true`, the `destination` and `underlyingError` properties will
     /// Returns whether the instance is `downloadedFileMoveFailed`. When `true`, the `destination` and `underlyingError` properties will
     /// contain the associated values.
     /// contain the associated values.
-    public var isDownloadedFileMoveError: Bool {
+    var isDownloadedFileMoveError: Bool {
         if case .downloadedFileMoveFailed = self { return true }
         if case .downloadedFileMoveFailed = self { return true }
         return false
         return false
     }
     }
 
 
     /// Returns whether the instance is `createURLRequestFailed`. When `true`, the `underlyingError` property will
     /// Returns whether the instance is `createURLRequestFailed`. When `true`, the `underlyingError` property will
     /// contain the associated value.
     /// contain the associated value.
-    public var isSessionTaskError: Bool {
+    var isSessionTaskError: Bool {
         if case .sessionTaskFailed = self { return true }
         if case .sessionTaskFailed = self { return true }
         return false
         return false
     }
     }
@@ -361,15 +361,15 @@ extension AFError {
 
 
 // MARK: - Convenience Properties
 // MARK: - Convenience Properties
 
 
-extension AFError {
+public extension AFError {
     /// The `URLConvertible` associated with the error.
     /// The `URLConvertible` associated with the error.
-    public var urlConvertible: URLConvertible? {
+    var urlConvertible: URLConvertible? {
         guard case let .invalidURL(url) = self else { return nil }
         guard case let .invalidURL(url) = self else { return nil }
         return url
         return url
     }
     }
 
 
     /// The `URL` associated with the error.
     /// The `URL` associated with the error.
-    public var url: URL? {
+    var url: URL? {
         guard case let .multipartEncodingFailed(reason) = self else { return nil }
         guard case let .multipartEncodingFailed(reason) = self else { return nil }
         return reason.url
         return reason.url
     }
     }
@@ -377,7 +377,7 @@ extension AFError {
     /// The underlying `Error` responsible for generating the failure associated with `.sessionInvalidated`,
     /// The underlying `Error` responsible for generating the failure associated with `.sessionInvalidated`,
     /// `.parameterEncodingFailed`, `.parameterEncoderFailed`, `.multipartEncodingFailed`, `.requestAdaptationFailed`,
     /// `.parameterEncodingFailed`, `.parameterEncoderFailed`, `.multipartEncodingFailed`, `.requestAdaptationFailed`,
     /// `.responseSerializationFailed`, `.requestRetryFailed` errors.
     /// `.responseSerializationFailed`, `.requestRetryFailed` errors.
-    public var underlyingError: Error? {
+    var underlyingError: Error? {
         switch self {
         switch self {
         case let .multipartEncodingFailed(reason):
         case let .multipartEncodingFailed(reason):
             return reason.underlyingError
             return reason.underlyingError
@@ -394,8 +394,8 @@ extension AFError {
         case let .responseSerializationFailed(reason):
         case let .responseSerializationFailed(reason):
             return reason.underlyingError
             return reason.underlyingError
         #if !(os(Linux) || os(Windows))
         #if !(os(Linux) || os(Windows))
-        case let .serverTrustEvaluationFailed(reason):
-            return reason.underlyingError
+            case let .serverTrustEvaluationFailed(reason):
+                return reason.underlyingError
         #endif
         #endif
         case let .sessionInvalidated(error):
         case let .sessionInvalidated(error):
             return error
             return error
@@ -416,46 +416,46 @@ extension AFError {
     }
     }
 
 
     /// The acceptable `Content-Type`s of a `.responseValidationFailed` error.
     /// The acceptable `Content-Type`s of a `.responseValidationFailed` error.
-    public var acceptableContentTypes: [String]? {
+    var acceptableContentTypes: [String]? {
         guard case let .responseValidationFailed(reason) = self else { return nil }
         guard case let .responseValidationFailed(reason) = self else { return nil }
         return reason.acceptableContentTypes
         return reason.acceptableContentTypes
     }
     }
 
 
     /// The response `Content-Type` of a `.responseValidationFailed` error.
     /// The response `Content-Type` of a `.responseValidationFailed` error.
-    public var responseContentType: String? {
+    var responseContentType: String? {
         guard case let .responseValidationFailed(reason) = self else { return nil }
         guard case let .responseValidationFailed(reason) = self else { return nil }
         return reason.responseContentType
         return reason.responseContentType
     }
     }
 
 
     /// The response code of a `.responseValidationFailed` error.
     /// The response code of a `.responseValidationFailed` error.
-    public var responseCode: Int? {
+    var responseCode: Int? {
         guard case let .responseValidationFailed(reason) = self else { return nil }
         guard case let .responseValidationFailed(reason) = self else { return nil }
         return reason.responseCode
         return reason.responseCode
     }
     }
 
 
     /// The `String.Encoding` associated with a failed `.stringResponse()` call.
     /// The `String.Encoding` associated with a failed `.stringResponse()` call.
-    public var failedStringEncoding: String.Encoding? {
+    var failedStringEncoding: String.Encoding? {
         guard case let .responseSerializationFailed(reason) = self else { return nil }
         guard case let .responseSerializationFailed(reason) = self else { return nil }
         return reason.failedStringEncoding
         return reason.failedStringEncoding
     }
     }
 
 
     /// The `source` URL of a `.downloadedFileMoveFailed` error.
     /// The `source` URL of a `.downloadedFileMoveFailed` error.
-    public var sourceURL: URL? {
+    var sourceURL: URL? {
         guard case let .downloadedFileMoveFailed(_, source, _) = self else { return nil }
         guard case let .downloadedFileMoveFailed(_, source, _) = self else { return nil }
         return source
         return source
     }
     }
 
 
     /// The `destination` URL of a `.downloadedFileMoveFailed` error.
     /// The `destination` URL of a `.downloadedFileMoveFailed` error.
-    public var destinationURL: URL? {
+    var destinationURL: URL? {
         guard case let .downloadedFileMoveFailed(_, _, destination) = self else { return nil }
         guard case let .downloadedFileMoveFailed(_, _, destination) = self else { return nil }
         return destination
         return destination
     }
     }
 
 
     #if !(os(Linux) || os(Windows))
     #if !(os(Linux) || os(Windows))
-    /// The download resume data of any underlying network error. Only produced by `DownloadRequest`s.
-    public var downloadResumeData: Data? {
-        (underlyingError as? URLError)?.userInfo[NSURLSessionDownloadTaskResumeData] as? Data
-    }
+        /// The download resume data of any underlying network error. Only produced by `DownloadRequest`s.
+        var downloadResumeData: Data? {
+            (underlyingError as? URLError)?.userInfo[NSURLSessionDownloadTaskResumeData] as? Data
+        }
     #endif
     #endif
 }
 }
 
 
@@ -611,48 +611,48 @@ extension AFError.ResponseSerializationFailureReason {
 }
 }
 
 
 #if !(os(Linux) || os(Windows))
 #if !(os(Linux) || os(Windows))
-extension AFError.ServerTrustFailureReason {
-    var output: AFError.ServerTrustFailureReason.Output? {
-        switch self {
-        case let .defaultEvaluationFailed(output),
-             let .hostValidationFailed(output),
-             let .revocationCheckFailed(output, _):
-            return output
-        case .noRequiredEvaluator,
-             .noCertificatesFound,
-             .noPublicKeysFound,
-             .policyApplicationFailed,
-             .settingAnchorCertificatesFailed,
-             .revocationPolicyCreationFailed,
-             .trustEvaluationFailed,
-             .certificatePinningFailed,
-             .publicKeyPinningFailed,
-             .customEvaluationFailed:
-            return nil
+    extension AFError.ServerTrustFailureReason {
+        var output: AFError.ServerTrustFailureReason.Output? {
+            switch self {
+            case let .defaultEvaluationFailed(output),
+                 let .hostValidationFailed(output),
+                 let .revocationCheckFailed(output, _):
+                return output
+            case .noRequiredEvaluator,
+                 .noCertificatesFound,
+                 .noPublicKeysFound,
+                 .policyApplicationFailed,
+                 .settingAnchorCertificatesFailed,
+                 .revocationPolicyCreationFailed,
+                 .trustEvaluationFailed,
+                 .certificatePinningFailed,
+                 .publicKeyPinningFailed,
+                 .customEvaluationFailed:
+                return nil
+            }
         }
         }
-    }
 
 
-    var underlyingError: Error? {
-        switch self {
-        case let .customEvaluationFailed(error):
-            return error
-        case let .trustEvaluationFailed(error):
-            return error
-        case .noRequiredEvaluator,
-             .noCertificatesFound,
-             .noPublicKeysFound,
-             .policyApplicationFailed,
-             .settingAnchorCertificatesFailed,
-             .revocationPolicyCreationFailed,
-             .defaultEvaluationFailed,
-             .hostValidationFailed,
-             .revocationCheckFailed,
-             .certificatePinningFailed,
-             .publicKeyPinningFailed:
-            return nil
+        var underlyingError: Error? {
+            switch self {
+            case let .customEvaluationFailed(error):
+                return error
+            case let .trustEvaluationFailed(error):
+                return error
+            case .noRequiredEvaluator,
+                 .noCertificatesFound,
+                 .noPublicKeysFound,
+                 .policyApplicationFailed,
+                 .settingAnchorCertificatesFailed,
+                 .revocationPolicyCreationFailed,
+                 .defaultEvaluationFailed,
+                 .hostValidationFailed,
+                 .revocationCheckFailed,
+                 .certificatePinningFailed,
+                 .publicKeyPinningFailed:
+                return nil
+            }
         }
         }
     }
     }
-}
 #endif
 #endif
 
 
 // MARK: - Error Descriptions
 // MARK: - Error Descriptions
@@ -689,8 +689,8 @@ extension AFError: LocalizedError {
         case let .sessionInvalidated(error):
         case let .sessionInvalidated(error):
             return "Session was invalidated with error: \(error?.localizedDescription ?? "No description.")"
             return "Session was invalidated with error: \(error?.localizedDescription ?? "No description.")"
         #if !(os(Linux) || os(Windows))
         #if !(os(Linux) || os(Windows))
-        case let .serverTrustEvaluationFailed(reason):
-            return "Server trust evaluation failed due to reason: \(reason.localizedDescription)"
+            case let .serverTrustEvaluationFailed(reason):
+                return "Server trust evaluation failed due to reason: \(reason.localizedDescription)"
         #endif
         #endif
         case let .urlRequestValidationFailed(reason):
         case let .urlRequestValidationFailed(reason):
             return "URLRequest validation failed due to reason: \(reason.localizedDescription)"
             return "URLRequest validation failed due to reason: \(reason.localizedDescription)"
@@ -823,38 +823,38 @@ extension AFError.ResponseValidationFailureReason {
 }
 }
 
 
 #if !(os(Linux) || os(Windows))
 #if !(os(Linux) || os(Windows))
-extension AFError.ServerTrustFailureReason {
-    var localizedDescription: String {
-        switch self {
-        case let .noRequiredEvaluator(host):
-            return "A ServerTrustEvaluating value is required for host \(host) but none was found."
-        case .noCertificatesFound:
-            return "No certificates were found or provided for evaluation."
-        case .noPublicKeysFound:
-            return "No public keys were found or provided for evaluation."
-        case .policyApplicationFailed:
-            return "Attempting to set a SecPolicy failed."
-        case .settingAnchorCertificatesFailed:
-            return "Attempting to set the provided certificates as anchor certificates failed."
-        case .revocationPolicyCreationFailed:
-            return "Attempting to create a revocation policy failed."
-        case let .trustEvaluationFailed(error):
-            return "SecTrust evaluation failed with error: \(error?.localizedDescription ?? "None")"
-        case let .defaultEvaluationFailed(output):
-            return "Default evaluation failed for host \(output.host)."
-        case let .hostValidationFailed(output):
-            return "Host validation failed for host \(output.host)."
-        case let .revocationCheckFailed(output, _):
-            return "Revocation check failed for host \(output.host)."
-        case let .certificatePinningFailed(host, _, _, _):
-            return "Certificate pinning failed for host \(host)."
-        case let .publicKeyPinningFailed(host, _, _, _):
-            return "Public key pinning failed for host \(host)."
-        case let .customEvaluationFailed(error):
-            return "Custom trust evaluation failed with error: \(error.localizedDescription)"
+    extension AFError.ServerTrustFailureReason {
+        var localizedDescription: String {
+            switch self {
+            case let .noRequiredEvaluator(host):
+                return "A ServerTrustEvaluating value is required for host \(host) but none was found."
+            case .noCertificatesFound:
+                return "No certificates were found or provided for evaluation."
+            case .noPublicKeysFound:
+                return "No public keys were found or provided for evaluation."
+            case .policyApplicationFailed:
+                return "Attempting to set a SecPolicy failed."
+            case .settingAnchorCertificatesFailed:
+                return "Attempting to set the provided certificates as anchor certificates failed."
+            case .revocationPolicyCreationFailed:
+                return "Attempting to create a revocation policy failed."
+            case let .trustEvaluationFailed(error):
+                return "SecTrust evaluation failed with error: \(error?.localizedDescription ?? "None")"
+            case let .defaultEvaluationFailed(output):
+                return "Default evaluation failed for host \(output.host)."
+            case let .hostValidationFailed(output):
+                return "Host validation failed for host \(output.host)."
+            case let .revocationCheckFailed(output, _):
+                return "Revocation check failed for host \(output.host)."
+            case let .certificatePinningFailed(host, _, _, _):
+                return "Certificate pinning failed for host \(host)."
+            case let .publicKeyPinningFailed(host, _, _, _):
+                return "Public key pinning failed for host \(host)."
+            case let .customEvaluationFailed(error):
+                return "Custom trust evaluation failed with error: \(error.localizedDescription)"
+            }
         }
         }
     }
     }
-}
 #endif
 #endif
 
 
 extension AFError.URLRequestValidationFailureReason {
 extension AFError.URLRequestValidationFailureReason {

+ 1 - 1
Example/Pods/Alamofire/Source/Alamofire.swift

@@ -25,7 +25,7 @@
 import Dispatch
 import Dispatch
 import Foundation
 import Foundation
 #if canImport(FoundationNetworking)
 #if canImport(FoundationNetworking)
-@_exported import FoundationNetworking
+    @_exported import FoundationNetworking
 #endif
 #endif
 
 
 /// Reference to `Session.default` for quick bootstrapping and examples.
 /// Reference to `Session.default` for quick bootstrapping and examples.

+ 3 - 3
Example/Pods/Alamofire/Source/AlamofireExtended.swift

@@ -46,15 +46,15 @@ public protocol AlamofireExtended {
     var af: AlamofireExtension<ExtendedType> { get set }
     var af: AlamofireExtension<ExtendedType> { get set }
 }
 }
 
 
-extension AlamofireExtended {
+public extension AlamofireExtended {
     /// Static Alamofire extension point.
     /// Static Alamofire extension point.
-    public static var af: AlamofireExtension<Self>.Type {
+    static var af: AlamofireExtension<Self>.Type {
         get { AlamofireExtension<Self>.self }
         get { AlamofireExtension<Self>.self }
         set {}
         set {}
     }
     }
 
 
     /// Instance Alamofire extension point.
     /// Instance Alamofire extension point.
-    public var af: AlamofireExtension<Self> {
+    var af: AlamofireExtension<Self> {
         get { AlamofireExtension(self) }
         get { AlamofireExtension(self) }
         set {}
         set {}
     }
     }

+ 2 - 1
Example/Pods/Alamofire/Source/AuthenticationInterceptor.swift

@@ -240,7 +240,8 @@ public class AuthenticationInterceptor<AuthenticatorType>: RequestInterceptor wh
     ///   - refreshWindow: The `RefreshWindow` used to identify excessive refresh calls. `RefreshWindow()` by default.
     ///   - refreshWindow: The `RefreshWindow` used to identify excessive refresh calls. `RefreshWindow()` by default.
     public init(authenticator: AuthenticatorType,
     public init(authenticator: AuthenticatorType,
                 credential: Credential? = nil,
                 credential: Credential? = nil,
-                refreshWindow: RefreshWindow? = RefreshWindow()) {
+                refreshWindow: RefreshWindow? = RefreshWindow())
+    {
         self.authenticator = authenticator
         self.authenticator = authenticator
         mutableState.credential = credential
         mutableState.credential = credential
         mutableState.refreshWindow = refreshWindow
         mutableState.refreshWindow = refreshWindow

+ 2 - 1
Example/Pods/Alamofire/Source/CachedResponseHandler.swift

@@ -77,7 +77,8 @@ public struct ResponseCacher {
 extension ResponseCacher: CachedResponseHandler {
 extension ResponseCacher: CachedResponseHandler {
     public func dataTask(_ task: URLSessionDataTask,
     public func dataTask(_ task: URLSessionDataTask,
                          willCacheResponse response: CachedURLResponse,
                          willCacheResponse response: CachedURLResponse,
-                         completion: @escaping (CachedURLResponse?) -> Void) {
+                         completion: @escaping (CachedURLResponse?) -> Void)
+    {
         switch behavior {
         switch behavior {
         case .cache:
         case .cache:
             completion(response)
             completion(response)

+ 540 - 521
Example/Pods/Alamofire/Source/Combine.swift

@@ -24,599 +24,618 @@
 
 
 #if !((os(iOS) && (arch(i386) || arch(arm))) || os(Windows) || os(Linux))
 #if !((os(iOS) && (arch(i386) || arch(arm))) || os(Windows) || os(Linux))
 
 
-import Combine
-import Dispatch
-import Foundation
-
-// MARK: - DataRequest / UploadRequest
-
-/// A Combine `Publisher` that publishes the `DataResponse<Value, AFError>` of the provided `DataRequest`.
-@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-public struct DataResponsePublisher<Value>: Publisher {
-    public typealias Output = DataResponse<Value, AFError>
-    public typealias Failure = Never
-
-    private typealias Handler = (@escaping (_ response: DataResponse<Value, AFError>) -> Void) -> DataRequest
-
-    private let request: DataRequest
-    private let responseHandler: Handler
-
-    /// Creates an instance which will serialize responses using the provided `ResponseSerializer`.
-    ///
-    /// - Parameters:
-    ///   - request:    `DataRequest` for which to publish the response.
-    ///   - queue:      `DispatchQueue` on which the `DataResponse` value will be published. `.main` by default.
-    ///   - serializer: `ResponseSerializer` used to produce the published `DataResponse`.
-    public init<Serializer: ResponseSerializer>(_ request: DataRequest, queue: DispatchQueue, serializer: Serializer)
-        where Value == Serializer.SerializedObject {
-        self.request = request
-        responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }
-    }
-
-    /// Creates an instance which will serialize responses using the provided `DataResponseSerializerProtocol`.
-    ///
-    /// - Parameters:
-    ///   - request:    `DataRequest` for which to publish the response.
-    ///   - queue:      `DispatchQueue` on which the `DataResponse` value will be published. `.main` by default.
-    ///   - serializer: `DataResponseSerializerProtocol` used to produce the published `DataResponse`.
-    public init<Serializer: DataResponseSerializerProtocol>(_ request: DataRequest,
-                                                            queue: DispatchQueue,
-                                                            serializer: Serializer)
-        where Value == Serializer.SerializedObject {
-        self.request = request
-        responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }
-    }
-
-    /// Publishes only the `Result` of the `DataResponse` value.
-    ///
-    /// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.
-    public func result() -> AnyPublisher<Result<Value, AFError>, Never> {
-        map { $0.result }.eraseToAnyPublisher()
-    }
+    import Combine
+    import Dispatch
+    import Foundation
 
 
-    /// Publishes the `Result` of the `DataResponse` as a single `Value` or fail with the `AFError` instance.
-    ///
-    /// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.
-    public func value() -> AnyPublisher<Value, AFError> {
-        setFailureType(to: AFError.self).flatMap { $0.result.publisher }.eraseToAnyPublisher()
-    }
+    // MARK: - DataRequest / UploadRequest
 
 
-    public func receive<S>(subscriber: S) where S: Subscriber, DataResponsePublisher.Failure == S.Failure, DataResponsePublisher.Output == S.Input {
-        subscriber.receive(subscription: Inner(request: request,
-                                               responseHandler: responseHandler,
-                                               downstream: subscriber))
-    }
+    /// A Combine `Publisher` that publishes the `DataResponse<Value, AFError>` of the provided `DataRequest`.
+    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+    public struct DataResponsePublisher<Value>: Publisher {
+        public typealias Output = DataResponse<Value, AFError>
+        public typealias Failure = Never
 
 
-    private final class Inner<Downstream: Subscriber>: Subscription, Cancellable
-        where Downstream.Input == Output {
-        typealias Failure = Downstream.Failure
+        private typealias Handler = (@escaping (_ response: DataResponse<Value, AFError>) -> Void) -> DataRequest
 
 
-        @Protected
-        private var downstream: Downstream?
         private let request: DataRequest
         private let request: DataRequest
         private let responseHandler: Handler
         private let responseHandler: Handler
 
 
-        init(request: DataRequest, responseHandler: @escaping Handler, downstream: Downstream) {
+        /// Creates an instance which will serialize responses using the provided `ResponseSerializer`.
+        ///
+        /// - Parameters:
+        ///   - request:    `DataRequest` for which to publish the response.
+        ///   - queue:      `DispatchQueue` on which the `DataResponse` value will be published. `.main` by default.
+        ///   - serializer: `ResponseSerializer` used to produce the published `DataResponse`.
+        public init<Serializer: ResponseSerializer>(_ request: DataRequest, queue: DispatchQueue, serializer: Serializer)
+            where Value == Serializer.SerializedObject
+        {
             self.request = request
             self.request = request
-            self.responseHandler = responseHandler
-            self.downstream = downstream
+            responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }
         }
         }
 
 
-        func request(_ demand: Subscribers.Demand) {
-            assert(demand > 0)
+        /// Creates an instance which will serialize responses using the provided `DataResponseSerializerProtocol`.
+        ///
+        /// - Parameters:
+        ///   - request:    `DataRequest` for which to publish the response.
+        ///   - queue:      `DispatchQueue` on which the `DataResponse` value will be published. `.main` by default.
+        ///   - serializer: `DataResponseSerializerProtocol` used to produce the published `DataResponse`.
+        public init<Serializer: DataResponseSerializerProtocol>(_ request: DataRequest,
+                                                                queue: DispatchQueue,
+                                                                serializer: Serializer)
+            where Value == Serializer.SerializedObject
+        {
+            self.request = request
+            responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }
+        }
 
 
-            guard let downstream = downstream else { return }
+        /// Publishes only the `Result` of the `DataResponse` value.
+        ///
+        /// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.
+        public func result() -> AnyPublisher<Result<Value, AFError>, Never> {
+            map { $0.result }.eraseToAnyPublisher()
+        }
 
 
-            self.downstream = nil
-            responseHandler { response in
-                _ = downstream.receive(response)
-                downstream.receive(completion: .finished)
-            }.resume()
+        /// Publishes the `Result` of the `DataResponse` as a single `Value` or fail with the `AFError` instance.
+        ///
+        /// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.
+        public func value() -> AnyPublisher<Value, AFError> {
+            setFailureType(to: AFError.self).flatMap { $0.result.publisher }.eraseToAnyPublisher()
         }
         }
 
 
-        func cancel() {
-            request.cancel()
-            downstream = nil
+        public func receive<S>(subscriber: S) where S: Subscriber, DataResponsePublisher.Failure == S.Failure, DataResponsePublisher.Output == S.Input {
+            subscriber.receive(subscription: Inner(request: request,
+                                                   responseHandler: responseHandler,
+                                                   downstream: subscriber))
         }
         }
-    }
-}
 
 
-@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-extension DataResponsePublisher where Value == Data? {
-    /// Creates an instance which publishes a `DataResponse<Data?, AFError>` value without serialization.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public init(_ request: DataRequest, queue: DispatchQueue) {
-        self.request = request
-        responseHandler = { request.response(queue: queue, completionHandler: $0) }
-    }
-}
-
-extension DataRequest {
-    /// Creates a `DataResponsePublisher` for this instance using the given `ResponseSerializer` and `DispatchQueue`.
-    ///
-    /// - Parameters:
-    ///   - serializer: `ResponseSerializer` used to serialize response `Data`.
-    ///   - queue:      `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
-    ///
-    /// - Returns:      The `DataResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishResponse<Serializer: ResponseSerializer, T>(using serializer: Serializer, on queue: DispatchQueue = .main) -> DataResponsePublisher<T>
-        where Serializer.SerializedObject == T {
-        DataResponsePublisher(self, queue: queue, serializer: serializer)
-    }
+        private final class Inner<Downstream: Subscriber>: Subscription, Cancellable
+            where Downstream.Input == Output
+        {
+            typealias Failure = Downstream.Failure
 
 
-    /// Creates a `DataResponsePublisher` for this instance and uses a `DataResponseSerializer` to serialize the
-    /// response.
-    ///
-    /// - Parameters:
-    ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
-    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
-    ///                          by default.
-    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
-    ///                          default.
-    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
-    ///                          status code. `[.head]` by default.
-    /// - Returns:               The `DataResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishData(queue: DispatchQueue = .main,
-                            preprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
-                            emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
-                            emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DataResponsePublisher<Data> {
-        publishResponse(using: DataResponseSerializer(dataPreprocessor: preprocessor,
-                                                      emptyResponseCodes: emptyResponseCodes,
-                                                      emptyRequestMethods: emptyRequestMethods),
-                        on: queue)
-    }
+            @Protected
+            private var downstream: Downstream?
+            private let request: DataRequest
+            private let responseHandler: Handler
 
 
-    /// Creates a `DataResponsePublisher` for this instance and uses a `StringResponseSerializer` to serialize the
-    /// response.
-    ///
-    /// - Parameters:
-    ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
-    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
-    ///                          by default.
-    ///   - encoding:            `String.Encoding` to parse the response. `nil` by default, in which case the encoding
-    ///                          will be determined by the server response, falling back to the default HTTP character
-    ///                          set, `ISO-8859-1`.
-    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
-    ///                          default.
-    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
-    ///                          status code. `[.head]` by default.
-    ///
-    /// - Returns:               The `DataResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishString(queue: DispatchQueue = .main,
-                              preprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
-                              encoding: String.Encoding? = nil,
-                              emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
-                              emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) -> DataResponsePublisher<String> {
-        publishResponse(using: StringResponseSerializer(dataPreprocessor: preprocessor,
-                                                        encoding: encoding,
-                                                        emptyResponseCodes: emptyResponseCodes,
-                                                        emptyRequestMethods: emptyRequestMethods),
-                        on: queue)
-    }
+            init(request: DataRequest, responseHandler: @escaping Handler, downstream: Downstream) {
+                self.request = request
+                self.responseHandler = responseHandler
+                self.downstream = downstream
+            }
 
 
-    /// Creates a `DataResponsePublisher` for this instance and uses a `DecodableResponseSerializer` to serialize the
-    /// response.
-    ///
-    /// - Parameters:
-    ///   - type:                `Decodable` type to which to decode response `Data`. Inferred from the context by default.
-    ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
-    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
-    ///                          by default.
-    ///   - decoder:             `DataDecoder` instance used to decode response `Data`. `JSONDecoder()` by default.
-    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
-    ///                          default.
-    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
-    ///                          status code. `[.head]` by default.
-    ///
-    /// - Returns:               The `DataResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishDecodable<T: Decodable>(type: T.Type = T.self,
-                                               queue: DispatchQueue = .main,
-                                               preprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,
-                                               decoder: DataDecoder = JSONDecoder(),
-                                               emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,
-                                               emptyResponseMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods) -> DataResponsePublisher<T> {
-        publishResponse(using: DecodableResponseSerializer(dataPreprocessor: preprocessor,
-                                                           decoder: decoder,
-                                                           emptyResponseCodes: emptyResponseCodes,
-                                                           emptyRequestMethods: emptyResponseMethods),
-                        on: queue)
-    }
+            func request(_ demand: Subscribers.Demand) {
+                assert(demand > 0)
 
 
-    /// Creates a `DataResponsePublisher` for this instance which does not serialize the response before publishing.
-    ///
-    ///   - queue: `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
-    ///
-    /// - Returns: The `DataResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishUnserialized(queue: DispatchQueue = .main) -> DataResponsePublisher<Data?> {
-        DataResponsePublisher(self, queue: queue)
-    }
-}
-
-// A Combine `Publisher` that publishes a sequence of `Stream<Value, AFError>` values received by the provided `DataStreamRequest`.
-@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-public struct DataStreamPublisher<Value>: Publisher {
-    public typealias Output = DataStreamRequest.Stream<Value, AFError>
-    public typealias Failure = Never
-
-    private typealias Handler = (@escaping DataStreamRequest.Handler<Value, AFError>) -> DataStreamRequest
-
-    private let request: DataStreamRequest
-    private let streamHandler: Handler
-
-    /// Creates an instance which will serialize responses using the provided `DataStreamSerializer`.
-    ///
-    /// - Parameters:
-    ///   - request:    `DataStreamRequest` for which to publish the response.
-    ///   - queue:      `DispatchQueue` on which the `Stream<Value, AFError>` values will be published. `.main` by
-    ///                 default.
-    ///   - serializer: `DataStreamSerializer` used to produce the published `Stream<Value, AFError>` values.
-    public init<Serializer: DataStreamSerializer>(_ request: DataStreamRequest, queue: DispatchQueue, serializer: Serializer)
-        where Value == Serializer.SerializedObject {
-        self.request = request
-        streamHandler = { request.responseStream(using: serializer, on: queue, stream: $0) }
-    }
+                guard let downstream = downstream else { return }
 
 
-    /// Publishes only the `Result` of the `DataStreamRequest.Stream`'s `Event`s.
-    ///
-    /// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.
-    public func result() -> AnyPublisher<Result<Value, AFError>, Never> {
-        compactMap { stream in
-            switch stream.event {
-            case let .stream(result):
-                return result
-            // If the stream has completed with an error, send the error value downstream as a `.failure`.
-            case let .complete(completion):
-                return completion.error.map(Result.failure)
+                self.downstream = nil
+                responseHandler { response in
+                    _ = downstream.receive(response)
+                    downstream.receive(completion: .finished)
+                }.resume()
+            }
+
+            func cancel() {
+                request.cancel()
+                downstream = nil
             }
             }
         }
         }
-        .eraseToAnyPublisher()
     }
     }
 
 
-    /// Publishes the streamed values of the `DataStreamRequest.Stream` as a sequence of `Value` or fail with the
-    /// `AFError` instance.
-    ///
-    /// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.
-    public func value() -> AnyPublisher<Value, AFError> {
-        result().setFailureType(to: AFError.self).flatMap { $0.publisher }.eraseToAnyPublisher()
+    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+    public extension DataResponsePublisher where Value == Data? {
+        /// Creates an instance which publishes a `DataResponse<Data?, AFError>` value without serialization.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        init(_ request: DataRequest, queue: DispatchQueue) {
+            self.request = request
+            responseHandler = { request.response(queue: queue, completionHandler: $0) }
+        }
     }
     }
 
 
-    public func receive<S>(subscriber: S) where S: Subscriber, DataStreamPublisher.Failure == S.Failure, DataStreamPublisher.Output == S.Input {
-        subscriber.receive(subscription: Inner(request: request,
-                                               streamHandler: streamHandler,
-                                               downstream: subscriber))
+    public extension DataRequest {
+        /// Creates a `DataResponsePublisher` for this instance using the given `ResponseSerializer` and `DispatchQueue`.
+        ///
+        /// - Parameters:
+        ///   - serializer: `ResponseSerializer` used to serialize response `Data`.
+        ///   - queue:      `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
+        ///
+        /// - Returns:      The `DataResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishResponse<Serializer: ResponseSerializer, T>(using serializer: Serializer, on queue: DispatchQueue = .main) -> DataResponsePublisher<T>
+            where Serializer.SerializedObject == T
+        {
+            DataResponsePublisher(self, queue: queue, serializer: serializer)
+        }
+
+        /// Creates a `DataResponsePublisher` for this instance and uses a `DataResponseSerializer` to serialize the
+        /// response.
+        ///
+        /// - Parameters:
+        ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
+        ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
+        ///                          by default.
+        ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
+        ///                          default.
+        ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
+        ///                          status code. `[.head]` by default.
+        /// - Returns:               The `DataResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishData(queue: DispatchQueue = .main,
+                         preprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
+                         emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
+                         emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DataResponsePublisher<Data>
+        {
+            publishResponse(using: DataResponseSerializer(dataPreprocessor: preprocessor,
+                                                          emptyResponseCodes: emptyResponseCodes,
+                                                          emptyRequestMethods: emptyRequestMethods),
+                            on: queue)
+        }
+
+        /// Creates a `DataResponsePublisher` for this instance and uses a `StringResponseSerializer` to serialize the
+        /// response.
+        ///
+        /// - Parameters:
+        ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
+        ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
+        ///                          by default.
+        ///   - encoding:            `String.Encoding` to parse the response. `nil` by default, in which case the encoding
+        ///                          will be determined by the server response, falling back to the default HTTP character
+        ///                          set, `ISO-8859-1`.
+        ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
+        ///                          default.
+        ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
+        ///                          status code. `[.head]` by default.
+        ///
+        /// - Returns:               The `DataResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishString(queue: DispatchQueue = .main,
+                           preprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
+                           encoding: String.Encoding? = nil,
+                           emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
+                           emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) -> DataResponsePublisher<String>
+        {
+            publishResponse(using: StringResponseSerializer(dataPreprocessor: preprocessor,
+                                                            encoding: encoding,
+                                                            emptyResponseCodes: emptyResponseCodes,
+                                                            emptyRequestMethods: emptyRequestMethods),
+                            on: queue)
+        }
+
+        /// Creates a `DataResponsePublisher` for this instance and uses a `DecodableResponseSerializer` to serialize the
+        /// response.
+        ///
+        /// - Parameters:
+        ///   - type:                `Decodable` type to which to decode response `Data`. Inferred from the context by default.
+        ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
+        ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
+        ///                          by default.
+        ///   - decoder:             `DataDecoder` instance used to decode response `Data`. `JSONDecoder()` by default.
+        ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
+        ///                          default.
+        ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
+        ///                          status code. `[.head]` by default.
+        ///
+        /// - Returns:               The `DataResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishDecodable<T: Decodable>(type _: T.Type = T.self,
+                                            queue: DispatchQueue = .main,
+                                            preprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,
+                                            decoder: DataDecoder = JSONDecoder(),
+                                            emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,
+                                            emptyResponseMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods) -> DataResponsePublisher<T>
+        {
+            publishResponse(using: DecodableResponseSerializer(dataPreprocessor: preprocessor,
+                                                               decoder: decoder,
+                                                               emptyResponseCodes: emptyResponseCodes,
+                                                               emptyRequestMethods: emptyResponseMethods),
+                            on: queue)
+        }
+
+        /// Creates a `DataResponsePublisher` for this instance which does not serialize the response before publishing.
+        ///
+        ///   - queue: `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
+        ///
+        /// - Returns: The `DataResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishUnserialized(queue: DispatchQueue = .main) -> DataResponsePublisher<Data?> {
+            DataResponsePublisher(self, queue: queue)
+        }
     }
     }
 
 
-    private final class Inner<Downstream: Subscriber>: Subscription, Cancellable
-        where Downstream.Input == Output {
-        typealias Failure = Downstream.Failure
+    // A Combine `Publisher` that publishes a sequence of `Stream<Value, AFError>` values received by the provided `DataStreamRequest`.
+    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+    public struct DataStreamPublisher<Value>: Publisher {
+        public typealias Output = DataStreamRequest.Stream<Value, AFError>
+        public typealias Failure = Never
+
+        private typealias Handler = (@escaping DataStreamRequest.Handler<Value, AFError>) -> DataStreamRequest
 
 
-        @Protected
-        private var downstream: Downstream?
         private let request: DataStreamRequest
         private let request: DataStreamRequest
         private let streamHandler: Handler
         private let streamHandler: Handler
 
 
-        init(request: DataStreamRequest, streamHandler: @escaping Handler, downstream: Downstream) {
+        /// Creates an instance which will serialize responses using the provided `DataStreamSerializer`.
+        ///
+        /// - Parameters:
+        ///   - request:    `DataStreamRequest` for which to publish the response.
+        ///   - queue:      `DispatchQueue` on which the `Stream<Value, AFError>` values will be published. `.main` by
+        ///                 default.
+        ///   - serializer: `DataStreamSerializer` used to produce the published `Stream<Value, AFError>` values.
+        public init<Serializer: DataStreamSerializer>(_ request: DataStreamRequest, queue: DispatchQueue, serializer: Serializer)
+            where Value == Serializer.SerializedObject
+        {
             self.request = request
             self.request = request
-            self.streamHandler = streamHandler
-            self.downstream = downstream
+            streamHandler = { request.responseStream(using: serializer, on: queue, stream: $0) }
         }
         }
 
 
-        func request(_ demand: Subscribers.Demand) {
-            assert(demand > 0)
-
-            guard let downstream = downstream else { return }
-
-            self.downstream = nil
-            streamHandler { stream in
-                _ = downstream.receive(stream)
-                if case .complete = stream.event {
-                    downstream.receive(completion: .finished)
+        /// Publishes only the `Result` of the `DataStreamRequest.Stream`'s `Event`s.
+        ///
+        /// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.
+        public func result() -> AnyPublisher<Result<Value, AFError>, Never> {
+            compactMap { stream in
+                switch stream.event {
+                case let .stream(result):
+                    return result
+                // If the stream has completed with an error, send the error value downstream as a `.failure`.
+                case let .complete(completion):
+                    return completion.error.map(Result.failure)
                 }
                 }
-            }.resume()
+            }
+            .eraseToAnyPublisher()
         }
         }
 
 
-        func cancel() {
-            request.cancel()
-            downstream = nil
+        /// Publishes the streamed values of the `DataStreamRequest.Stream` as a sequence of `Value` or fail with the
+        /// `AFError` instance.
+        ///
+        /// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.
+        public func value() -> AnyPublisher<Value, AFError> {
+            result().setFailureType(to: AFError.self).flatMap { $0.publisher }.eraseToAnyPublisher()
         }
         }
-    }
-}
-
-extension DataStreamRequest {
-    /// Creates a `DataStreamPublisher` for this instance using the given `DataStreamSerializer` and `DispatchQueue`.
-    ///
-    /// - Parameters:
-    ///   - serializer: `DataStreamSerializer` used to serialize the streamed `Data`.
-    ///   - queue:      `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.
-    /// - Returns:      The `DataStreamPublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishStream<Serializer: DataStreamSerializer>(using serializer: Serializer,
-                                                                on queue: DispatchQueue = .main) -> DataStreamPublisher<Serializer.SerializedObject> {
-        DataStreamPublisher(self, queue: queue, serializer: serializer)
-    }
 
 
-    /// Creates a `DataStreamPublisher` for this instance which uses a `PassthroughStreamSerializer` to stream `Data`
-    /// unserialized.
-    ///
-    /// - Parameters:
-    ///   - queue:      `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.
-    /// - Returns:      The `DataStreamPublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishData(queue: DispatchQueue = .main) -> DataStreamPublisher<Data> {
-        publishStream(using: PassthroughStreamSerializer(), on: queue)
-    }
+        public func receive<S>(subscriber: S) where S: Subscriber, DataStreamPublisher.Failure == S.Failure, DataStreamPublisher.Output == S.Input {
+            subscriber.receive(subscription: Inner(request: request,
+                                                   streamHandler: streamHandler,
+                                                   downstream: subscriber))
+        }
 
 
-    /// Creates a `DataStreamPublisher` for this instance which uses a `StringStreamSerializer` to serialize stream
-    /// `Data` values into `String` values.
-    ///
-    /// - Parameters:
-    ///   - queue:      `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.
-    /// - Returns:      The `DataStreamPublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishString(queue: DispatchQueue = .main) -> DataStreamPublisher<String> {
-        publishStream(using: StringStreamSerializer(), on: queue)
-    }
+        private final class Inner<Downstream: Subscriber>: Subscription, Cancellable
+            where Downstream.Input == Output
+        {
+            typealias Failure = Downstream.Failure
 
 
-    /// Creates a `DataStreamPublisher` for this instance which uses a `DecodableStreamSerializer` with the provided
-    /// parameters to serialize stream `Data` values into the provided type.
-    ///
-    /// - Parameters:
-    ///   - type:         `Decodable` type to which to decode stream `Data`. Inferred from the context by default.
-    ///   - queue:        `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.
-    ///   - decoder:      `DataDecoder` instance used to decode stream `Data`. `JSONDecoder()` by default.
-    ///   - preprocessor: `DataPreprocessor` which filters incoming stream `Data` before serialization.
-    ///                   `PassthroughPreprocessor()` by default.
-    /// - Returns:        The `DataStreamPublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishDecodable<T: Decodable>(type: T.Type = T.self,
-                                               queue: DispatchQueue = .main,
-                                               decoder: DataDecoder = JSONDecoder(),
-                                               preprocessor: DataPreprocessor = PassthroughPreprocessor()) -> DataStreamPublisher<T> {
-        publishStream(using: DecodableStreamSerializer(decoder: decoder,
-                                                       dataPreprocessor: preprocessor),
-                      on: queue)
-    }
-}
-
-/// A Combine `Publisher` that publishes the `DownloadResponse<Value, AFError>` of the provided `DownloadRequest`.
-@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-public struct DownloadResponsePublisher<Value>: Publisher {
-    public typealias Output = DownloadResponse<Value, AFError>
-    public typealias Failure = Never
-
-    private typealias Handler = (@escaping (_ response: DownloadResponse<Value, AFError>) -> Void) -> DownloadRequest
-
-    private let request: DownloadRequest
-    private let responseHandler: Handler
-
-    /// Creates an instance which will serialize responses using the provided `ResponseSerializer`.
-    ///
-    /// - Parameters:
-    ///   - request:    `DownloadRequest` for which to publish the response.
-    ///   - queue:      `DispatchQueue` on which the `DownloadResponse` value will be published. `.main` by default.
-    ///   - serializer: `ResponseSerializer` used to produce the published `DownloadResponse`.
-    public init<Serializer: ResponseSerializer>(_ request: DownloadRequest, queue: DispatchQueue, serializer: Serializer)
-        where Value == Serializer.SerializedObject {
-        self.request = request
-        responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }
-    }
+            @Protected
+            private var downstream: Downstream?
+            private let request: DataStreamRequest
+            private let streamHandler: Handler
 
 
-    /// Creates an instance which will serialize responses using the provided `DownloadResponseSerializerProtocol` value.
-    ///
-    /// - Parameters:
-    ///   - request:    `DownloadRequest` for which to publish the response.
-    ///   - queue:      `DispatchQueue` on which the `DataResponse` value will be published. `.main` by default.
-    ///   - serializer: `DownloadResponseSerializerProtocol` used to produce the published `DownloadResponse`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public init<Serializer: DownloadResponseSerializerProtocol>(_ request: DownloadRequest,
-                                                                queue: DispatchQueue,
-                                                                serializer: Serializer)
-        where Value == Serializer.SerializedObject {
-        self.request = request
-        responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }
-    }
+            init(request: DataStreamRequest, streamHandler: @escaping Handler, downstream: Downstream) {
+                self.request = request
+                self.streamHandler = streamHandler
+                self.downstream = downstream
+            }
 
 
-    /// Publishes only the `Result` of the `DownloadResponse` value.
-    ///
-    /// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.
-    public func result() -> AnyPublisher<Result<Value, AFError>, Never> {
-        map { $0.result }.eraseToAnyPublisher()
-    }
+            func request(_ demand: Subscribers.Demand) {
+                assert(demand > 0)
+
+                guard let downstream = downstream else { return }
 
 
-    /// Publishes the `Result` of the `DownloadResponse` as a single `Value` or fail with the `AFError` instance.
-    ///
-    /// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.
-    public func value() -> AnyPublisher<Value, AFError> {
-        setFailureType(to: AFError.self).flatMap { $0.result.publisher }.eraseToAnyPublisher()
+                self.downstream = nil
+                streamHandler { stream in
+                    _ = downstream.receive(stream)
+                    if case .complete = stream.event {
+                        downstream.receive(completion: .finished)
+                    }
+                }.resume()
+            }
+
+            func cancel() {
+                request.cancel()
+                downstream = nil
+            }
+        }
     }
     }
 
 
-    public func receive<S>(subscriber: S) where S: Subscriber, DownloadResponsePublisher.Failure == S.Failure, DownloadResponsePublisher.Output == S.Input {
-        subscriber.receive(subscription: Inner(request: request,
-                                               responseHandler: responseHandler,
-                                               downstream: subscriber))
+    public extension DataStreamRequest {
+        /// Creates a `DataStreamPublisher` for this instance using the given `DataStreamSerializer` and `DispatchQueue`.
+        ///
+        /// - Parameters:
+        ///   - serializer: `DataStreamSerializer` used to serialize the streamed `Data`.
+        ///   - queue:      `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.
+        /// - Returns:      The `DataStreamPublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishStream<Serializer: DataStreamSerializer>(using serializer: Serializer,
+                                                             on queue: DispatchQueue = .main) -> DataStreamPublisher<Serializer.SerializedObject>
+        {
+            DataStreamPublisher(self, queue: queue, serializer: serializer)
+        }
+
+        /// Creates a `DataStreamPublisher` for this instance which uses a `PassthroughStreamSerializer` to stream `Data`
+        /// unserialized.
+        ///
+        /// - Parameters:
+        ///   - queue:      `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.
+        /// - Returns:      The `DataStreamPublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishData(queue: DispatchQueue = .main) -> DataStreamPublisher<Data> {
+            publishStream(using: PassthroughStreamSerializer(), on: queue)
+        }
+
+        /// Creates a `DataStreamPublisher` for this instance which uses a `StringStreamSerializer` to serialize stream
+        /// `Data` values into `String` values.
+        ///
+        /// - Parameters:
+        ///   - queue:      `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.
+        /// - Returns:      The `DataStreamPublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishString(queue: DispatchQueue = .main) -> DataStreamPublisher<String> {
+            publishStream(using: StringStreamSerializer(), on: queue)
+        }
+
+        /// Creates a `DataStreamPublisher` for this instance which uses a `DecodableStreamSerializer` with the provided
+        /// parameters to serialize stream `Data` values into the provided type.
+        ///
+        /// - Parameters:
+        ///   - type:         `Decodable` type to which to decode stream `Data`. Inferred from the context by default.
+        ///   - queue:        `DispatchQueue` on which the `DataRequest.Stream` values will be published. `.main` by default.
+        ///   - decoder:      `DataDecoder` instance used to decode stream `Data`. `JSONDecoder()` by default.
+        ///   - preprocessor: `DataPreprocessor` which filters incoming stream `Data` before serialization.
+        ///                   `PassthroughPreprocessor()` by default.
+        /// - Returns:        The `DataStreamPublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishDecodable<T: Decodable>(type _: T.Type = T.self,
+                                            queue: DispatchQueue = .main,
+                                            decoder: DataDecoder = JSONDecoder(),
+                                            preprocessor: DataPreprocessor = PassthroughPreprocessor()) -> DataStreamPublisher<T>
+        {
+            publishStream(using: DecodableStreamSerializer(decoder: decoder,
+                                                           dataPreprocessor: preprocessor),
+                          on: queue)
+        }
     }
     }
 
 
-    private final class Inner<Downstream: Subscriber>: Subscription, Cancellable
-        where Downstream.Input == Output {
-        typealias Failure = Downstream.Failure
+    /// A Combine `Publisher` that publishes the `DownloadResponse<Value, AFError>` of the provided `DownloadRequest`.
+    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+    public struct DownloadResponsePublisher<Value>: Publisher {
+        public typealias Output = DownloadResponse<Value, AFError>
+        public typealias Failure = Never
+
+        private typealias Handler = (@escaping (_ response: DownloadResponse<Value, AFError>) -> Void) -> DownloadRequest
 
 
-        @Protected
-        private var downstream: Downstream?
         private let request: DownloadRequest
         private let request: DownloadRequest
         private let responseHandler: Handler
         private let responseHandler: Handler
 
 
-        init(request: DownloadRequest, responseHandler: @escaping Handler, downstream: Downstream) {
+        /// Creates an instance which will serialize responses using the provided `ResponseSerializer`.
+        ///
+        /// - Parameters:
+        ///   - request:    `DownloadRequest` for which to publish the response.
+        ///   - queue:      `DispatchQueue` on which the `DownloadResponse` value will be published. `.main` by default.
+        ///   - serializer: `ResponseSerializer` used to produce the published `DownloadResponse`.
+        public init<Serializer: ResponseSerializer>(_ request: DownloadRequest, queue: DispatchQueue, serializer: Serializer)
+            where Value == Serializer.SerializedObject
+        {
             self.request = request
             self.request = request
-            self.responseHandler = responseHandler
-            self.downstream = downstream
+            responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }
         }
         }
 
 
-        func request(_ demand: Subscribers.Demand) {
-            assert(demand > 0)
+        /// Creates an instance which will serialize responses using the provided `DownloadResponseSerializerProtocol` value.
+        ///
+        /// - Parameters:
+        ///   - request:    `DownloadRequest` for which to publish the response.
+        ///   - queue:      `DispatchQueue` on which the `DataResponse` value will be published. `.main` by default.
+        ///   - serializer: `DownloadResponseSerializerProtocol` used to produce the published `DownloadResponse`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        public init<Serializer: DownloadResponseSerializerProtocol>(_ request: DownloadRequest,
+                                                                    queue: DispatchQueue,
+                                                                    serializer: Serializer)
+            where Value == Serializer.SerializedObject
+        {
+            self.request = request
+            responseHandler = { request.response(queue: queue, responseSerializer: serializer, completionHandler: $0) }
+        }
 
 
-            guard let downstream = downstream else { return }
+        /// Publishes only the `Result` of the `DownloadResponse` value.
+        ///
+        /// - Returns: The `AnyPublisher` publishing the `Result<Value, AFError>` value.
+        public func result() -> AnyPublisher<Result<Value, AFError>, Never> {
+            map { $0.result }.eraseToAnyPublisher()
+        }
 
 
-            self.downstream = nil
-            responseHandler { response in
-                _ = downstream.receive(response)
-                downstream.receive(completion: .finished)
-            }.resume()
+        /// Publishes the `Result` of the `DownloadResponse` as a single `Value` or fail with the `AFError` instance.
+        ///
+        /// - Returns: The `AnyPublisher<Value, AFError>` publishing the stream.
+        public func value() -> AnyPublisher<Value, AFError> {
+            setFailureType(to: AFError.self).flatMap { $0.result.publisher }.eraseToAnyPublisher()
         }
         }
 
 
-        func cancel() {
-            request.cancel()
-            downstream = nil
+        public func receive<S>(subscriber: S) where S: Subscriber, DownloadResponsePublisher.Failure == S.Failure, DownloadResponsePublisher.Output == S.Input {
+            subscriber.receive(subscription: Inner(request: request,
+                                                   responseHandler: responseHandler,
+                                                   downstream: subscriber))
         }
         }
-    }
-}
-
-extension DownloadRequest {
-    /// Creates a `DownloadResponsePublisher` for this instance using the given `ResponseSerializer` and `DispatchQueue`.
-    ///
-    /// - Parameters:
-    ///   - serializer: `ResponseSerializer` used to serialize the response `Data` from disk.
-    ///   - queue:      `DispatchQueue` on which the `DownloadResponse` will be published.`.main` by default.
-    ///
-    /// - Returns:      The `DownloadResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishResponse<Serializer: ResponseSerializer, T>(using serializer: Serializer, on queue: DispatchQueue = .main) -> DownloadResponsePublisher<T>
-        where Serializer.SerializedObject == T {
-        DownloadResponsePublisher(self, queue: queue, serializer: serializer)
-    }
 
 
-    /// Creates a `DownloadResponsePublisher` for this instance using the given `DownloadResponseSerializerProtocol` and
-    /// `DispatchQueue`.
-    ///
-    /// - Parameters:
-    ///   - serializer: `DownloadResponseSerializer` used to serialize the response `Data` from disk.
-    ///   - queue:      `DispatchQueue` on which the `DownloadResponse` will be published.`.main` by default.
-    ///
-    /// - Returns:      The `DownloadResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishResponse<Serializer: DownloadResponseSerializerProtocol, T>(using serializer: Serializer, on queue: DispatchQueue = .main) -> DownloadResponsePublisher<T>
-        where Serializer.SerializedObject == T {
-        DownloadResponsePublisher(self, queue: queue, serializer: serializer)
-    }
+        private final class Inner<Downstream: Subscriber>: Subscription, Cancellable
+            where Downstream.Input == Output
+        {
+            typealias Failure = Downstream.Failure
 
 
-    /// Creates a `DownloadResponsePublisher` for this instance and uses a `URLResponseSerializer` to serialize the
-    /// response.
-    ///
-    /// - Parameter queue: `DispatchQueue` on which the `DownloadResponse` will be published. `.main` by default.
-    ///
-    /// - Returns:         The `DownloadResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishURL(queue: DispatchQueue = .main) -> DownloadResponsePublisher<URL> {
-        publishResponse(using: URLResponseSerializer(), on: queue)
-    }
+            @Protected
+            private var downstream: Downstream?
+            private let request: DownloadRequest
+            private let responseHandler: Handler
 
 
-    /// Creates a `DownloadResponsePublisher` for this instance and uses a `DataResponseSerializer` to serialize the
-    /// response.
-    ///
-    /// - Parameters:
-    ///   - queue:               `DispatchQueue` on which the `DownloadResponse` will be published. `.main` by default.
-    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
-    ///                          by default.
-    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
-    ///                          default.
-    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
-    ///                          status code. `[.head]` by default.
-    ///
-    /// - Returns:               The `DownloadResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishData(queue: DispatchQueue = .main,
-                            preprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
-                            emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
-                            emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DownloadResponsePublisher<Data> {
-        publishResponse(using: DataResponseSerializer(dataPreprocessor: preprocessor,
-                                                      emptyResponseCodes: emptyResponseCodes,
-                                                      emptyRequestMethods: emptyRequestMethods),
-                        on: queue)
-    }
+            init(request: DownloadRequest, responseHandler: @escaping Handler, downstream: Downstream) {
+                self.request = request
+                self.responseHandler = responseHandler
+                self.downstream = downstream
+            }
 
 
-    /// Creates a `DataResponsePublisher` for this instance and uses a `StringResponseSerializer` to serialize the
-    /// response.
-    ///
-    /// - Parameters:
-    ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
-    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
-    ///                          by default.
-    ///   - encoding:            `String.Encoding` to parse the response. `nil` by default, in which case the encoding
-    ///                          will be determined by the server response, falling back to the default HTTP character
-    ///                          set, `ISO-8859-1`.
-    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
-    ///                          default.
-    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
-    ///                          status code. `[.head]` by default.
-    ///
-    /// - Returns:               The `DownloadResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishString(queue: DispatchQueue = .main,
-                              preprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
-                              encoding: String.Encoding? = nil,
-                              emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
-                              emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) -> DownloadResponsePublisher<String> {
-        publishResponse(using: StringResponseSerializer(dataPreprocessor: preprocessor,
-                                                        encoding: encoding,
-                                                        emptyResponseCodes: emptyResponseCodes,
-                                                        emptyRequestMethods: emptyRequestMethods),
-                        on: queue)
+            func request(_ demand: Subscribers.Demand) {
+                assert(demand > 0)
+
+                guard let downstream = downstream else { return }
+
+                self.downstream = nil
+                responseHandler { response in
+                    _ = downstream.receive(response)
+                    downstream.receive(completion: .finished)
+                }.resume()
+            }
+
+            func cancel() {
+                request.cancel()
+                downstream = nil
+            }
+        }
     }
     }
 
 
-    /// Creates a `DataResponsePublisher` for this instance and uses a `DecodableResponseSerializer` to serialize the
-    /// response.
-    ///
-    /// - Parameters:
-    ///   - type:                `Decodable` type to which to decode response `Data`. Inferred from the context by default.
-    ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
-    ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
-    ///                          by default.
-    ///   - decoder:             `DataDecoder` instance used to decode response `Data`. `JSONDecoder()` by default.
-    ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
-    ///                          default.
-    ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
-    ///                          status code. `[.head]` by default.
-    ///
-    /// - Returns:               The `DownloadResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishDecodable<T: Decodable>(type: T.Type = T.self,
-                                               queue: DispatchQueue = .main,
-                                               preprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,
-                                               decoder: DataDecoder = JSONDecoder(),
-                                               emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,
-                                               emptyResponseMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods) -> DownloadResponsePublisher<T> {
-        publishResponse(using: DecodableResponseSerializer(dataPreprocessor: preprocessor,
-                                                           decoder: decoder,
-                                                           emptyResponseCodes: emptyResponseCodes,
-                                                           emptyRequestMethods: emptyResponseMethods),
-                        on: queue)
+    public extension DownloadRequest {
+        /// Creates a `DownloadResponsePublisher` for this instance using the given `ResponseSerializer` and `DispatchQueue`.
+        ///
+        /// - Parameters:
+        ///   - serializer: `ResponseSerializer` used to serialize the response `Data` from disk.
+        ///   - queue:      `DispatchQueue` on which the `DownloadResponse` will be published.`.main` by default.
+        ///
+        /// - Returns:      The `DownloadResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishResponse<Serializer: ResponseSerializer, T>(using serializer: Serializer, on queue: DispatchQueue = .main) -> DownloadResponsePublisher<T>
+            where Serializer.SerializedObject == T
+        {
+            DownloadResponsePublisher(self, queue: queue, serializer: serializer)
+        }
+
+        /// Creates a `DownloadResponsePublisher` for this instance using the given `DownloadResponseSerializerProtocol` and
+        /// `DispatchQueue`.
+        ///
+        /// - Parameters:
+        ///   - serializer: `DownloadResponseSerializer` used to serialize the response `Data` from disk.
+        ///   - queue:      `DispatchQueue` on which the `DownloadResponse` will be published.`.main` by default.
+        ///
+        /// - Returns:      The `DownloadResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishResponse<Serializer: DownloadResponseSerializerProtocol, T>(using serializer: Serializer, on queue: DispatchQueue = .main) -> DownloadResponsePublisher<T>
+            where Serializer.SerializedObject == T
+        {
+            DownloadResponsePublisher(self, queue: queue, serializer: serializer)
+        }
+
+        /// Creates a `DownloadResponsePublisher` for this instance and uses a `URLResponseSerializer` to serialize the
+        /// response.
+        ///
+        /// - Parameter queue: `DispatchQueue` on which the `DownloadResponse` will be published. `.main` by default.
+        ///
+        /// - Returns:         The `DownloadResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishURL(queue: DispatchQueue = .main) -> DownloadResponsePublisher<URL> {
+            publishResponse(using: URLResponseSerializer(), on: queue)
+        }
+
+        /// Creates a `DownloadResponsePublisher` for this instance and uses a `DataResponseSerializer` to serialize the
+        /// response.
+        ///
+        /// - Parameters:
+        ///   - queue:               `DispatchQueue` on which the `DownloadResponse` will be published. `.main` by default.
+        ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
+        ///                          by default.
+        ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
+        ///                          default.
+        ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
+        ///                          status code. `[.head]` by default.
+        ///
+        /// - Returns:               The `DownloadResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishData(queue: DispatchQueue = .main,
+                         preprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
+                         emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
+                         emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) -> DownloadResponsePublisher<Data>
+        {
+            publishResponse(using: DataResponseSerializer(dataPreprocessor: preprocessor,
+                                                          emptyResponseCodes: emptyResponseCodes,
+                                                          emptyRequestMethods: emptyRequestMethods),
+                            on: queue)
+        }
+
+        /// Creates a `DataResponsePublisher` for this instance and uses a `StringResponseSerializer` to serialize the
+        /// response.
+        ///
+        /// - Parameters:
+        ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
+        ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
+        ///                          by default.
+        ///   - encoding:            `String.Encoding` to parse the response. `nil` by default, in which case the encoding
+        ///                          will be determined by the server response, falling back to the default HTTP character
+        ///                          set, `ISO-8859-1`.
+        ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
+        ///                          default.
+        ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
+        ///                          status code. `[.head]` by default.
+        ///
+        /// - Returns:               The `DownloadResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishString(queue: DispatchQueue = .main,
+                           preprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
+                           encoding: String.Encoding? = nil,
+                           emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
+                           emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) -> DownloadResponsePublisher<String>
+        {
+            publishResponse(using: StringResponseSerializer(dataPreprocessor: preprocessor,
+                                                            encoding: encoding,
+                                                            emptyResponseCodes: emptyResponseCodes,
+                                                            emptyRequestMethods: emptyRequestMethods),
+                            on: queue)
+        }
+
+        /// Creates a `DataResponsePublisher` for this instance and uses a `DecodableResponseSerializer` to serialize the
+        /// response.
+        ///
+        /// - Parameters:
+        ///   - type:                `Decodable` type to which to decode response `Data`. Inferred from the context by default.
+        ///   - queue:               `DispatchQueue` on which the `DataResponse` will be published. `.main` by default.
+        ///   - preprocessor:        `DataPreprocessor` which filters the `Data` before serialization. `PassthroughPreprocessor()`
+        ///                          by default.
+        ///   - decoder:             `DataDecoder` instance used to decode response `Data`. `JSONDecoder()` by default.
+        ///   - emptyResponseCodes:  `Set<Int>` of HTTP status codes for which empty responses are allowed. `[204, 205]` by
+        ///                          default.
+        ///   - emptyRequestMethods: `Set<HTTPMethod>` of `HTTPMethod`s for which empty responses are allowed, regardless of
+        ///                          status code. `[.head]` by default.
+        ///
+        /// - Returns:               The `DownloadResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishDecodable<T: Decodable>(type _: T.Type = T.self,
+                                            queue: DispatchQueue = .main,
+                                            preprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,
+                                            decoder: DataDecoder = JSONDecoder(),
+                                            emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,
+                                            emptyResponseMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods) -> DownloadResponsePublisher<T>
+        {
+            publishResponse(using: DecodableResponseSerializer(dataPreprocessor: preprocessor,
+                                                               decoder: decoder,
+                                                               emptyResponseCodes: emptyResponseCodes,
+                                                               emptyRequestMethods: emptyResponseMethods),
+                            on: queue)
+        }
     }
     }
-}
 
 
-@available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-extension DownloadResponsePublisher where Value == URL? {
-    /// Creates an instance which publishes a `DownloadResponse<URL?, AFError>` value without serialization.
     @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
     @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public init(_ request: DownloadRequest, queue: DispatchQueue) {
-        self.request = request
-        responseHandler = { request.response(queue: queue, completionHandler: $0) }
+    public extension DownloadResponsePublisher where Value == URL? {
+        /// Creates an instance which publishes a `DownloadResponse<URL?, AFError>` value without serialization.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        init(_ request: DownloadRequest, queue: DispatchQueue) {
+            self.request = request
+            responseHandler = { request.response(queue: queue, completionHandler: $0) }
+        }
     }
     }
-}
-
-extension DownloadRequest {
-    /// Creates a `DownloadResponsePublisher` for this instance which does not serialize the response before publishing.
-    ///
-    /// - Parameter queue: `DispatchQueue` on which the `DownloadResponse` will be published. `.main` by default.
-    ///
-    /// - Returns:         The `DownloadResponsePublisher`.
-    @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
-    public func publishUnserialized(on queue: DispatchQueue = .main) -> DownloadResponsePublisher<URL?> {
-        DownloadResponsePublisher(self, queue: queue)
+
+    public extension DownloadRequest {
+        /// Creates a `DownloadResponsePublisher` for this instance which does not serialize the response before publishing.
+        ///
+        /// - Parameter queue: `DispatchQueue` on which the `DownloadResponse` will be published. `.main` by default.
+        ///
+        /// - Returns:         The `DownloadResponsePublisher`.
+        @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, *)
+        func publishUnserialized(on queue: DispatchQueue = .main) -> DownloadResponsePublisher<URL?> {
+            DownloadResponsePublisher(self, queue: queue)
+        }
     }
     }
-}
 
 
 #endif
 #endif

+ 114 - 98
Example/Pods/Alamofire/Source/EventMonitor.swift

@@ -220,92 +220,92 @@ public protocol EventMonitor {
     func request<Value>(_ request: DownloadRequest, didParseResponse response: DownloadResponse<Value, AFError>)
     func request<Value>(_ request: DownloadRequest, didParseResponse response: DownloadResponse<Value, AFError>)
 }
 }
 
 
-extension EventMonitor {
+public extension EventMonitor {
     /// The default queue on which `CompositeEventMonitor`s will call the `EventMonitor` methods. `.main` by default.
     /// The default queue on which `CompositeEventMonitor`s will call the `EventMonitor` methods. `.main` by default.
-    public var queue: DispatchQueue { .main }
+    var queue: DispatchQueue { .main }
 
 
     // MARK: Default Implementations
     // MARK: Default Implementations
 
 
-    public func urlSession(_ session: URLSession, didBecomeInvalidWithError error: Error?) {}
-    public func urlSession(_ session: URLSession,
-                           task: URLSessionTask,
-                           didReceive challenge: URLAuthenticationChallenge) {}
-    public func urlSession(_ session: URLSession,
-                           task: URLSessionTask,
-                           didSendBodyData bytesSent: Int64,
-                           totalBytesSent: Int64,
-                           totalBytesExpectedToSend: Int64) {}
-    public func urlSession(_ session: URLSession, taskNeedsNewBodyStream task: URLSessionTask) {}
-    public func urlSession(_ session: URLSession,
-                           task: URLSessionTask,
-                           willPerformHTTPRedirection response: HTTPURLResponse,
-                           newRequest request: URLRequest) {}
-    public func urlSession(_ session: URLSession,
-                           task: URLSessionTask,
-                           didFinishCollecting metrics: URLSessionTaskMetrics) {}
-    public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {}
-    public func urlSession(_ session: URLSession, taskIsWaitingForConnectivity task: URLSessionTask) {}
-    public func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) {}
-    public func urlSession(_ session: URLSession,
-                           dataTask: URLSessionDataTask,
-                           willCacheResponse proposedResponse: CachedURLResponse) {}
-    public func urlSession(_ session: URLSession,
-                           downloadTask: URLSessionDownloadTask,
-                           didResumeAtOffset fileOffset: Int64,
-                           expectedTotalBytes: Int64) {}
-    public func urlSession(_ session: URLSession,
-                           downloadTask: URLSessionDownloadTask,
-                           didWriteData bytesWritten: Int64,
-                           totalBytesWritten: Int64,
-                           totalBytesExpectedToWrite: Int64) {}
-    public func urlSession(_ session: URLSession,
-                           downloadTask: URLSessionDownloadTask,
-                           didFinishDownloadingTo location: URL) {}
-    public func request(_ request: Request, didCreateInitialURLRequest urlRequest: URLRequest) {}
-    public func request(_ request: Request, didFailToCreateURLRequestWithError error: AFError) {}
-    public func request(_ request: Request,
-                        didAdaptInitialRequest initialRequest: URLRequest,
-                        to adaptedRequest: URLRequest) {}
-    public func request(_ request: Request,
-                        didFailToAdaptURLRequest initialRequest: URLRequest,
-                        withError error: AFError) {}
-    public func request(_ request: Request, didCreateURLRequest urlRequest: URLRequest) {}
-    public func request(_ request: Request, didCreateTask task: URLSessionTask) {}
-    public func request(_ request: Request, didGatherMetrics metrics: URLSessionTaskMetrics) {}
-    public func request(_ request: Request, didFailTask task: URLSessionTask, earlyWithError error: AFError) {}
-    public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?) {}
-    public func requestIsRetrying(_ request: Request) {}
-    public func requestDidFinish(_ request: Request) {}
-    public func requestDidResume(_ request: Request) {}
-    public func request(_ request: Request, didResumeTask task: URLSessionTask) {}
-    public func requestDidSuspend(_ request: Request) {}
-    public func request(_ request: Request, didSuspendTask task: URLSessionTask) {}
-    public func requestDidCancel(_ request: Request) {}
-    public func request(_ request: Request, didCancelTask task: URLSessionTask) {}
-    public func request(_ request: DataRequest,
-                        didValidateRequest urlRequest: URLRequest?,
-                        response: HTTPURLResponse,
-                        data: Data?,
-                        withResult result: Request.ValidationResult) {}
-    public func request(_ request: DataRequest, didParseResponse response: DataResponse<Data?, AFError>) {}
-    public func request<Value>(_ request: DataRequest, didParseResponse response: DataResponse<Value, AFError>) {}
-    public func request(_ request: DataStreamRequest,
-                        didValidateRequest urlRequest: URLRequest?,
-                        response: HTTPURLResponse,
-                        withResult result: Request.ValidationResult) {}
-    public func request<Value>(_ request: DataStreamRequest, didParseStream result: Result<Value, AFError>) {}
-    public func request(_ request: UploadRequest, didCreateUploadable uploadable: UploadRequest.Uploadable) {}
-    public func request(_ request: UploadRequest, didFailToCreateUploadableWithError error: AFError) {}
-    public func request(_ request: UploadRequest, didProvideInputStream stream: InputStream) {}
-    public func request(_ request: DownloadRequest, didFinishDownloadingUsing task: URLSessionTask, with result: Result<URL, AFError>) {}
-    public func request(_ request: DownloadRequest, didCreateDestinationURL url: URL) {}
-    public func request(_ request: DownloadRequest,
-                        didValidateRequest urlRequest: URLRequest?,
-                        response: HTTPURLResponse,
-                        fileURL: URL?,
-                        withResult result: Request.ValidationResult) {}
-    public func request(_ request: DownloadRequest, didParseResponse response: DownloadResponse<URL?, AFError>) {}
-    public func request<Value>(_ request: DownloadRequest, didParseResponse response: DownloadResponse<Value, AFError>) {}
+    func urlSession(_: URLSession, didBecomeInvalidWithError _: Error?) {}
+    func urlSession(_: URLSession,
+                    task _: URLSessionTask,
+                    didReceive _: URLAuthenticationChallenge) {}
+    func urlSession(_: URLSession,
+                    task _: URLSessionTask,
+                    didSendBodyData _: Int64,
+                    totalBytesSent _: Int64,
+                    totalBytesExpectedToSend _: Int64) {}
+    func urlSession(_: URLSession, taskNeedsNewBodyStream _: URLSessionTask) {}
+    func urlSession(_: URLSession,
+                    task _: URLSessionTask,
+                    willPerformHTTPRedirection _: HTTPURLResponse,
+                    newRequest _: URLRequest) {}
+    func urlSession(_: URLSession,
+                    task _: URLSessionTask,
+                    didFinishCollecting _: URLSessionTaskMetrics) {}
+    func urlSession(_: URLSession, task _: URLSessionTask, didCompleteWithError _: Error?) {}
+    func urlSession(_: URLSession, taskIsWaitingForConnectivity _: URLSessionTask) {}
+    func urlSession(_: URLSession, dataTask _: URLSessionDataTask, didReceive _: Data) {}
+    func urlSession(_: URLSession,
+                    dataTask _: URLSessionDataTask,
+                    willCacheResponse _: CachedURLResponse) {}
+    func urlSession(_: URLSession,
+                    downloadTask _: URLSessionDownloadTask,
+                    didResumeAtOffset _: Int64,
+                    expectedTotalBytes _: Int64) {}
+    func urlSession(_: URLSession,
+                    downloadTask _: URLSessionDownloadTask,
+                    didWriteData _: Int64,
+                    totalBytesWritten _: Int64,
+                    totalBytesExpectedToWrite _: Int64) {}
+    func urlSession(_: URLSession,
+                    downloadTask _: URLSessionDownloadTask,
+                    didFinishDownloadingTo _: URL) {}
+    func request(_: Request, didCreateInitialURLRequest _: URLRequest) {}
+    func request(_: Request, didFailToCreateURLRequestWithError _: AFError) {}
+    func request(_: Request,
+                 didAdaptInitialRequest _: URLRequest,
+                 to _: URLRequest) {}
+    func request(_: Request,
+                 didFailToAdaptURLRequest _: URLRequest,
+                 withError _: AFError) {}
+    func request(_: Request, didCreateURLRequest _: URLRequest) {}
+    func request(_: Request, didCreateTask _: URLSessionTask) {}
+    func request(_: Request, didGatherMetrics _: URLSessionTaskMetrics) {}
+    func request(_: Request, didFailTask _: URLSessionTask, earlyWithError _: AFError) {}
+    func request(_: Request, didCompleteTask _: URLSessionTask, with _: AFError?) {}
+    func requestIsRetrying(_: Request) {}
+    func requestDidFinish(_: Request) {}
+    func requestDidResume(_: Request) {}
+    func request(_: Request, didResumeTask _: URLSessionTask) {}
+    func requestDidSuspend(_: Request) {}
+    func request(_: Request, didSuspendTask _: URLSessionTask) {}
+    func requestDidCancel(_: Request) {}
+    func request(_: Request, didCancelTask _: URLSessionTask) {}
+    func request(_: DataRequest,
+                 didValidateRequest _: URLRequest?,
+                 response _: HTTPURLResponse,
+                 data _: Data?,
+                 withResult _: Request.ValidationResult) {}
+    func request(_: DataRequest, didParseResponse _: DataResponse<Data?, AFError>) {}
+    func request<Value>(_: DataRequest, didParseResponse _: DataResponse<Value, AFError>) {}
+    func request(_: DataStreamRequest,
+                 didValidateRequest _: URLRequest?,
+                 response _: HTTPURLResponse,
+                 withResult _: Request.ValidationResult) {}
+    func request<Value>(_: DataStreamRequest, didParseStream _: Result<Value, AFError>) {}
+    func request(_: UploadRequest, didCreateUploadable _: UploadRequest.Uploadable) {}
+    func request(_: UploadRequest, didFailToCreateUploadableWithError _: AFError) {}
+    func request(_: UploadRequest, didProvideInputStream _: InputStream) {}
+    func request(_: DownloadRequest, didFinishDownloadingUsing _: URLSessionTask, with _: Result<URL, AFError>) {}
+    func request(_: DownloadRequest, didCreateDestinationURL _: URL) {}
+    func request(_: DownloadRequest,
+                 didValidateRequest _: URLRequest?,
+                 response _: HTTPURLResponse,
+                 fileURL _: URL?,
+                 withResult _: Request.ValidationResult) {}
+    func request(_: DownloadRequest, didParseResponse _: DownloadResponse<URL?, AFError>) {}
+    func request<Value>(_: DownloadRequest, didParseResponse _: DownloadResponse<Value, AFError>) {}
 }
 }
 
 
 /// An `EventMonitor` which can contain multiple `EventMonitor`s and calls their methods on their queues.
 /// An `EventMonitor` which can contain multiple `EventMonitor`s and calls their methods on their queues.
@@ -332,7 +332,8 @@ public final class CompositeEventMonitor: EventMonitor {
 
 
     public func urlSession(_ session: URLSession,
     public func urlSession(_ session: URLSession,
                            task: URLSessionTask,
                            task: URLSessionTask,
-                           didReceive challenge: URLAuthenticationChallenge) {
+                           didReceive challenge: URLAuthenticationChallenge)
+    {
         performEvent { $0.urlSession(session, task: task, didReceive: challenge) }
         performEvent { $0.urlSession(session, task: task, didReceive: challenge) }
     }
     }
 
 
@@ -340,7 +341,8 @@ public final class CompositeEventMonitor: EventMonitor {
                            task: URLSessionTask,
                            task: URLSessionTask,
                            didSendBodyData bytesSent: Int64,
                            didSendBodyData bytesSent: Int64,
                            totalBytesSent: Int64,
                            totalBytesSent: Int64,
-                           totalBytesExpectedToSend: Int64) {
+                           totalBytesExpectedToSend: Int64)
+    {
         performEvent {
         performEvent {
             $0.urlSession(session,
             $0.urlSession(session,
                           task: task,
                           task: task,
@@ -359,7 +361,8 @@ public final class CompositeEventMonitor: EventMonitor {
     public func urlSession(_ session: URLSession,
     public func urlSession(_ session: URLSession,
                            task: URLSessionTask,
                            task: URLSessionTask,
                            willPerformHTTPRedirection response: HTTPURLResponse,
                            willPerformHTTPRedirection response: HTTPURLResponse,
-                           newRequest request: URLRequest) {
+                           newRequest request: URLRequest)
+    {
         performEvent {
         performEvent {
             $0.urlSession(session,
             $0.urlSession(session,
                           task: task,
                           task: task,
@@ -387,14 +390,16 @@ public final class CompositeEventMonitor: EventMonitor {
 
 
     public func urlSession(_ session: URLSession,
     public func urlSession(_ session: URLSession,
                            dataTask: URLSessionDataTask,
                            dataTask: URLSessionDataTask,
-                           willCacheResponse proposedResponse: CachedURLResponse) {
+                           willCacheResponse proposedResponse: CachedURLResponse)
+    {
         performEvent { $0.urlSession(session, dataTask: dataTask, willCacheResponse: proposedResponse) }
         performEvent { $0.urlSession(session, dataTask: dataTask, willCacheResponse: proposedResponse) }
     }
     }
 
 
     public func urlSession(_ session: URLSession,
     public func urlSession(_ session: URLSession,
                            downloadTask: URLSessionDownloadTask,
                            downloadTask: URLSessionDownloadTask,
                            didResumeAtOffset fileOffset: Int64,
                            didResumeAtOffset fileOffset: Int64,
-                           expectedTotalBytes: Int64) {
+                           expectedTotalBytes: Int64)
+    {
         performEvent {
         performEvent {
             $0.urlSession(session,
             $0.urlSession(session,
                           downloadTask: downloadTask,
                           downloadTask: downloadTask,
@@ -407,7 +412,8 @@ public final class CompositeEventMonitor: EventMonitor {
                            downloadTask: URLSessionDownloadTask,
                            downloadTask: URLSessionDownloadTask,
                            didWriteData bytesWritten: Int64,
                            didWriteData bytesWritten: Int64,
                            totalBytesWritten: Int64,
                            totalBytesWritten: Int64,
-                           totalBytesExpectedToWrite: Int64) {
+                           totalBytesExpectedToWrite: Int64)
+    {
         performEvent {
         performEvent {
             $0.urlSession(session,
             $0.urlSession(session,
                           downloadTask: downloadTask,
                           downloadTask: downloadTask,
@@ -419,7 +425,8 @@ public final class CompositeEventMonitor: EventMonitor {
 
 
     public func urlSession(_ session: URLSession,
     public func urlSession(_ session: URLSession,
                            downloadTask: URLSessionDownloadTask,
                            downloadTask: URLSessionDownloadTask,
-                           didFinishDownloadingTo location: URL) {
+                           didFinishDownloadingTo location: URL)
+    {
         performEvent { $0.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location) }
         performEvent { $0.urlSession(session, downloadTask: downloadTask, didFinishDownloadingTo: location) }
     }
     }
 
 
@@ -495,7 +502,8 @@ public final class CompositeEventMonitor: EventMonitor {
                         didValidateRequest urlRequest: URLRequest?,
                         didValidateRequest urlRequest: URLRequest?,
                         response: HTTPURLResponse,
                         response: HTTPURLResponse,
                         data: Data?,
                         data: Data?,
-                        withResult result: Request.ValidationResult) {
+                        withResult result: Request.ValidationResult)
+    {
         performEvent { $0.request(request,
         performEvent { $0.request(request,
                                   didValidateRequest: urlRequest,
                                   didValidateRequest: urlRequest,
                                   response: response,
                                   response: response,
@@ -515,7 +523,8 @@ public final class CompositeEventMonitor: EventMonitor {
     public func request(_ request: DataStreamRequest,
     public func request(_ request: DataStreamRequest,
                         didValidateRequest urlRequest: URLRequest?,
                         didValidateRequest urlRequest: URLRequest?,
                         response: HTTPURLResponse,
                         response: HTTPURLResponse,
-                        withResult result: Request.ValidationResult) {
+                        withResult result: Request.ValidationResult)
+    {
         performEvent { $0.request(request,
         performEvent { $0.request(request,
                                   didValidateRequest: urlRequest,
                                   didValidateRequest: urlRequest,
                                   response: response,
                                   response: response,
@@ -551,7 +560,8 @@ public final class CompositeEventMonitor: EventMonitor {
                         didValidateRequest urlRequest: URLRequest?,
                         didValidateRequest urlRequest: URLRequest?,
                         response: HTTPURLResponse,
                         response: HTTPURLResponse,
                         fileURL: URL?,
                         fileURL: URL?,
-                        withResult result: Request.ValidationResult) {
+                        withResult result: Request.ValidationResult)
+    {
         performEvent { $0.request(request,
         performEvent { $0.request(request,
                                   didValidateRequest: urlRequest,
                                   didValidateRequest: urlRequest,
                                   response: response,
                                   response: response,
@@ -714,7 +724,8 @@ open class ClosureEventMonitor: EventMonitor {
                          task: URLSessionTask,
                          task: URLSessionTask,
                          didSendBodyData bytesSent: Int64,
                          didSendBodyData bytesSent: Int64,
                          totalBytesSent: Int64,
                          totalBytesSent: Int64,
-                         totalBytesExpectedToSend: Int64) {
+                         totalBytesExpectedToSend: Int64)
+    {
         taskDidSendBodyData?(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend)
         taskDidSendBodyData?(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend)
     }
     }
 
 
@@ -725,7 +736,8 @@ open class ClosureEventMonitor: EventMonitor {
     open func urlSession(_ session: URLSession,
     open func urlSession(_ session: URLSession,
                          task: URLSessionTask,
                          task: URLSessionTask,
                          willPerformHTTPRedirection response: HTTPURLResponse,
                          willPerformHTTPRedirection response: HTTPURLResponse,
-                         newRequest request: URLRequest) {
+                         newRequest request: URLRequest)
+    {
         taskWillPerformHTTPRedirection?(session, task, response, request)
         taskWillPerformHTTPRedirection?(session, task, response, request)
     }
     }
 
 
@@ -752,7 +764,8 @@ open class ClosureEventMonitor: EventMonitor {
     open func urlSession(_ session: URLSession,
     open func urlSession(_ session: URLSession,
                          downloadTask: URLSessionDownloadTask,
                          downloadTask: URLSessionDownloadTask,
                          didResumeAtOffset fileOffset: Int64,
                          didResumeAtOffset fileOffset: Int64,
-                         expectedTotalBytes: Int64) {
+                         expectedTotalBytes: Int64)
+    {
         downloadTaskDidResumeAtOffset?(session, downloadTask, fileOffset, expectedTotalBytes)
         downloadTaskDidResumeAtOffset?(session, downloadTask, fileOffset, expectedTotalBytes)
     }
     }
 
 
@@ -760,7 +773,8 @@ open class ClosureEventMonitor: EventMonitor {
                          downloadTask: URLSessionDownloadTask,
                          downloadTask: URLSessionDownloadTask,
                          didWriteData bytesWritten: Int64,
                          didWriteData bytesWritten: Int64,
                          totalBytesWritten: Int64,
                          totalBytesWritten: Int64,
-                         totalBytesExpectedToWrite: Int64) {
+                         totalBytesExpectedToWrite: Int64)
+    {
         downloadTaskDidWriteData?(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite)
         downloadTaskDidWriteData?(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite)
     }
     }
 
 
@@ -842,7 +856,8 @@ open class ClosureEventMonitor: EventMonitor {
                       didValidateRequest urlRequest: URLRequest?,
                       didValidateRequest urlRequest: URLRequest?,
                       response: HTTPURLResponse,
                       response: HTTPURLResponse,
                       data: Data?,
                       data: Data?,
-                      withResult result: Request.ValidationResult) {
+                      withResult result: Request.ValidationResult)
+    {
         requestDidValidateRequestResponseDataWithResult?(request, urlRequest, response, data, result)
         requestDidValidateRequestResponseDataWithResult?(request, urlRequest, response, data, result)
     }
     }
 
 
@@ -878,7 +893,8 @@ open class ClosureEventMonitor: EventMonitor {
                       didValidateRequest urlRequest: URLRequest?,
                       didValidateRequest urlRequest: URLRequest?,
                       response: HTTPURLResponse,
                       response: HTTPURLResponse,
                       fileURL: URL?,
                       fileURL: URL?,
-                      withResult result: Request.ValidationResult) {
+                      withResult result: Request.ValidationResult)
+    {
         requestDidValidateRequestResponseFileURLWithResult?(request,
         requestDidValidateRequestResponseFileURLWithResult?(request,
                                                             urlRequest,
                                                             urlRequest,
                                                             response,
                                                             response,

+ 36 - 36
Example/Pods/Alamofire/Source/HTTPHeaders.swift

@@ -215,12 +215,12 @@ extension HTTPHeader: CustomStringConvertible {
     }
     }
 }
 }
 
 
-extension HTTPHeader {
+public extension HTTPHeader {
     /// Returns an `Accept` header.
     /// Returns an `Accept` header.
     ///
     ///
     /// - Parameter value: The `Accept` value.
     /// - Parameter value: The `Accept` value.
     /// - Returns:         The header.
     /// - Returns:         The header.
-    public static func accept(_ value: String) -> HTTPHeader {
+    static func accept(_ value: String) -> HTTPHeader {
         HTTPHeader(name: "Accept", value: value)
         HTTPHeader(name: "Accept", value: value)
     }
     }
 
 
@@ -228,7 +228,7 @@ extension HTTPHeader {
     ///
     ///
     /// - Parameter value: The `Accept-Charset` value.
     /// - Parameter value: The `Accept-Charset` value.
     /// - Returns:         The header.
     /// - Returns:         The header.
-    public static func acceptCharset(_ value: String) -> HTTPHeader {
+    static func acceptCharset(_ value: String) -> HTTPHeader {
         HTTPHeader(name: "Accept-Charset", value: value)
         HTTPHeader(name: "Accept-Charset", value: value)
     }
     }
 
 
@@ -240,7 +240,7 @@ extension HTTPHeader {
     /// - Parameter value: The `Accept-Language` value.
     /// - Parameter value: The `Accept-Language` value.
     ///
     ///
     /// - Returns:         The header.
     /// - Returns:         The header.
-    public static func acceptLanguage(_ value: String) -> HTTPHeader {
+    static func acceptLanguage(_ value: String) -> HTTPHeader {
         HTTPHeader(name: "Accept-Language", value: value)
         HTTPHeader(name: "Accept-Language", value: value)
     }
     }
 
 
@@ -252,7 +252,7 @@ extension HTTPHeader {
     /// - Parameter value: The `Accept-Encoding` value.
     /// - Parameter value: The `Accept-Encoding` value.
     ///
     ///
     /// - Returns:         The header
     /// - Returns:         The header
-    public static func acceptEncoding(_ value: String) -> HTTPHeader {
+    static func acceptEncoding(_ value: String) -> HTTPHeader {
         HTTPHeader(name: "Accept-Encoding", value: value)
         HTTPHeader(name: "Accept-Encoding", value: value)
     }
     }
 
 
@@ -263,7 +263,7 @@ extension HTTPHeader {
     ///   - password: The password of the header.
     ///   - password: The password of the header.
     ///
     ///
     /// - Returns:    The header.
     /// - Returns:    The header.
-    public static func authorization(username: String, password: String) -> HTTPHeader {
+    static func authorization(username: String, password: String) -> HTTPHeader {
         let credential = Data("\(username):\(password)".utf8).base64EncodedString()
         let credential = Data("\(username):\(password)".utf8).base64EncodedString()
 
 
         return authorization("Basic \(credential)")
         return authorization("Basic \(credential)")
@@ -274,7 +274,7 @@ extension HTTPHeader {
     /// - Parameter bearerToken: The bearer token.
     /// - Parameter bearerToken: The bearer token.
     ///
     ///
     /// - Returns:               The header.
     /// - Returns:               The header.
-    public static func authorization(bearerToken: String) -> HTTPHeader {
+    static func authorization(bearerToken: String) -> HTTPHeader {
         authorization("Bearer \(bearerToken)")
         authorization("Bearer \(bearerToken)")
     }
     }
 
 
@@ -287,7 +287,7 @@ extension HTTPHeader {
     /// - Parameter value: The `Authorization` value.
     /// - Parameter value: The `Authorization` value.
     ///
     ///
     /// - Returns:         The header.
     /// - Returns:         The header.
-    public static func authorization(_ value: String) -> HTTPHeader {
+    static func authorization(_ value: String) -> HTTPHeader {
         HTTPHeader(name: "Authorization", value: value)
         HTTPHeader(name: "Authorization", value: value)
     }
     }
 
 
@@ -296,7 +296,7 @@ extension HTTPHeader {
     /// - Parameter value: The `Content-Disposition` value.
     /// - Parameter value: The `Content-Disposition` value.
     ///
     ///
     /// - Returns:         The header.
     /// - Returns:         The header.
-    public static func contentDisposition(_ value: String) -> HTTPHeader {
+    static func contentDisposition(_ value: String) -> HTTPHeader {
         HTTPHeader(name: "Content-Disposition", value: value)
         HTTPHeader(name: "Content-Disposition", value: value)
     }
     }
 
 
@@ -308,7 +308,7 @@ extension HTTPHeader {
     /// - Parameter value: The `Content-Type` value.
     /// - Parameter value: The `Content-Type` value.
     ///
     ///
     /// - Returns:         The header.
     /// - Returns:         The header.
-    public static func contentType(_ value: String) -> HTTPHeader {
+    static func contentType(_ value: String) -> HTTPHeader {
         HTTPHeader(name: "Content-Type", value: value)
         HTTPHeader(name: "Content-Type", value: value)
     }
     }
 
 
@@ -317,7 +317,7 @@ extension HTTPHeader {
     /// - Parameter value: The `User-Agent` value.
     /// - Parameter value: The `User-Agent` value.
     ///
     ///
     /// - Returns:         The header.
     /// - Returns:         The header.
-    public static func userAgent(_ value: String) -> HTTPHeader {
+    static func userAgent(_ value: String) -> HTTPHeader {
         HTTPHeader(name: "User-Agent", value: value)
         HTTPHeader(name: "User-Agent", value: value)
     }
     }
 }
 }
@@ -332,20 +332,20 @@ extension Array where Element == HTTPHeader {
 
 
 // MARK: - Defaults
 // MARK: - Defaults
 
 
-extension HTTPHeaders {
+public extension HTTPHeaders {
     /// The default set of `HTTPHeaders` used by Alamofire. Includes `Accept-Encoding`, `Accept-Language`, and
     /// The default set of `HTTPHeaders` used by Alamofire. Includes `Accept-Encoding`, `Accept-Language`, and
     /// `User-Agent`.
     /// `User-Agent`.
-    public static let `default`: HTTPHeaders = [.defaultAcceptEncoding,
-                                                .defaultAcceptLanguage,
-                                                .defaultUserAgent]
+    static let `default`: HTTPHeaders = [.defaultAcceptEncoding,
+                                         .defaultAcceptLanguage,
+                                         .defaultUserAgent]
 }
 }
 
 
-extension HTTPHeader {
+public extension HTTPHeader {
     /// Returns Alamofire's default `Accept-Encoding` header, appropriate for the encodings supported by particular OS
     /// Returns Alamofire's default `Accept-Encoding` header, appropriate for the encodings supported by particular OS
     /// versions.
     /// versions.
     ///
     ///
     /// See the [Accept-Encoding HTTP header documentation](https://tools.ietf.org/html/rfc7230#section-4.2.3) .
     /// See the [Accept-Encoding HTTP header documentation](https://tools.ietf.org/html/rfc7230#section-4.2.3) .
-    public static let defaultAcceptEncoding: HTTPHeader = {
+    static let defaultAcceptEncoding: HTTPHeader = {
         let encodings: [String]
         let encodings: [String]
         if #available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *) {
         if #available(iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0, *) {
             encodings = ["br", "gzip", "deflate"]
             encodings = ["br", "gzip", "deflate"]
@@ -360,7 +360,7 @@ extension HTTPHeader {
     /// `preferredLanguages`.
     /// `preferredLanguages`.
     ///
     ///
     /// See the [Accept-Language HTTP header documentation](https://tools.ietf.org/html/rfc7231#section-5.3.5).
     /// See the [Accept-Language HTTP header documentation](https://tools.ietf.org/html/rfc7231#section-5.3.5).
-    public static let defaultAcceptLanguage: HTTPHeader = {
+    static let defaultAcceptLanguage: HTTPHeader = {
         .acceptLanguage(Locale.preferredLanguages.prefix(6).qualityEncoded())
         .acceptLanguage(Locale.preferredLanguages.prefix(6).qualityEncoded())
     }()
     }()
 
 
@@ -369,7 +369,7 @@ extension HTTPHeader {
     /// See the [User-Agent header documentation](https://tools.ietf.org/html/rfc7231#section-5.5.3).
     /// See the [User-Agent header documentation](https://tools.ietf.org/html/rfc7231#section-5.5.3).
     ///
     ///
     /// Example: `iOS Example/1.0 (org.alamofire.iOS-Example; build:1; iOS 13.0.0) Alamofire/5.0.0`
     /// Example: `iOS Example/1.0 (org.alamofire.iOS-Example; build:1; iOS 13.0.0) Alamofire/5.0.0`
-    public static let defaultUserAgent: HTTPHeader = {
+    static let defaultUserAgent: HTTPHeader = {
         let info = Bundle.main.infoDictionary
         let info = Bundle.main.infoDictionary
         let executable = (info?["CFBundleExecutable"] as? String) ??
         let executable = (info?["CFBundleExecutable"] as? String) ??
             (ProcessInfo.processInfo.arguments.first?.split(separator: "/").last.map(String.init)) ??
             (ProcessInfo.processInfo.arguments.first?.split(separator: "/").last.map(String.init)) ??
@@ -383,23 +383,23 @@ extension HTTPHeader {
             let versionString = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)"
             let versionString = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)"
             let osName: String = {
             let osName: String = {
                 #if os(iOS)
                 #if os(iOS)
-                #if targetEnvironment(macCatalyst)
-                return "macOS(Catalyst)"
-                #else
-                return "iOS"
-                #endif
+                    #if targetEnvironment(macCatalyst)
+                        return "macOS(Catalyst)"
+                    #else
+                        return "iOS"
+                    #endif
                 #elseif os(watchOS)
                 #elseif os(watchOS)
-                return "watchOS"
+                    return "watchOS"
                 #elseif os(tvOS)
                 #elseif os(tvOS)
-                return "tvOS"
+                    return "tvOS"
                 #elseif os(macOS)
                 #elseif os(macOS)
-                return "macOS"
+                    return "macOS"
                 #elseif os(Linux)
                 #elseif os(Linux)
-                return "Linux"
+                    return "Linux"
                 #elseif os(Windows)
                 #elseif os(Windows)
-                return "Windows"
+                    return "Windows"
                 #else
                 #else
-                return "Unknown"
+                    return "Unknown"
                 #endif
                 #endif
             }()
             }()
 
 
@@ -425,24 +425,24 @@ extension Collection where Element == String {
 
 
 // MARK: - System Type Extensions
 // MARK: - System Type Extensions
 
 
-extension URLRequest {
+public extension URLRequest {
     /// Returns `allHTTPHeaderFields` as `HTTPHeaders`.
     /// Returns `allHTTPHeaderFields` as `HTTPHeaders`.
-    public var headers: HTTPHeaders {
+    var headers: HTTPHeaders {
         get { allHTTPHeaderFields.map(HTTPHeaders.init) ?? HTTPHeaders() }
         get { allHTTPHeaderFields.map(HTTPHeaders.init) ?? HTTPHeaders() }
         set { allHTTPHeaderFields = newValue.dictionary }
         set { allHTTPHeaderFields = newValue.dictionary }
     }
     }
 }
 }
 
 
-extension HTTPURLResponse {
+public extension HTTPURLResponse {
     /// Returns `allHeaderFields` as `HTTPHeaders`.
     /// Returns `allHeaderFields` as `HTTPHeaders`.
-    public var headers: HTTPHeaders {
+    var headers: HTTPHeaders {
         (allHeaderFields as? [String: String]).map(HTTPHeaders.init) ?? HTTPHeaders()
         (allHeaderFields as? [String: String]).map(HTTPHeaders.init) ?? HTTPHeaders()
     }
     }
 }
 }
 
 
-extension URLSessionConfiguration {
+public extension URLSessionConfiguration {
     /// Returns `httpAdditionalHeaders` as `HTTPHeaders`.
     /// Returns `httpAdditionalHeaders` as `HTTPHeaders`.
-    public var headers: HTTPHeaders {
+    var headers: HTTPHeaders {
         get { (httpAdditionalHeaders as? [String: String]).map(HTTPHeaders.init) ?? HTTPHeaders() }
         get { (httpAdditionalHeaders as? [String: String]).map(HTTPHeaders.init) ?? HTTPHeaders() }
         set { httpAdditionalHeaders = newValue.dictionary }
         set { httpAdditionalHeaders = newValue.dictionary }
     }
     }

+ 20 - 18
Example/Pods/Alamofire/Source/MultipartFormData.swift

@@ -25,9 +25,9 @@
 import Foundation
 import Foundation
 
 
 #if os(iOS) || os(watchOS) || os(tvOS)
 #if os(iOS) || os(watchOS) || os(tvOS)
-import MobileCoreServices
+    import MobileCoreServices
 #elseif os(macOS)
 #elseif os(macOS)
-import CoreServices
+    import CoreServices
 #endif
 #endif
 
 
 /// Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode
 /// Constructs `multipart/form-data` for uploads within an HTTP or HTTPS body. There are currently two ways to encode
@@ -175,7 +175,7 @@ open class MultipartFormData {
         let fileName = fileURL.lastPathComponent
         let fileName = fileURL.lastPathComponent
         let pathExtension = fileURL.pathExtension
         let pathExtension = fileURL.pathExtension
 
 
-        if !fileName.isEmpty && !pathExtension.isEmpty {
+        if !fileName.isEmpty, !pathExtension.isEmpty {
             let mime = mimeType(forPathExtension: pathExtension)
             let mime = mimeType(forPathExtension: pathExtension)
             append(fileURL, withName: name, fileName: fileName, mimeType: mime)
             append(fileURL, withName: name, fileName: fileName, mimeType: mime)
         } else {
         } else {
@@ -214,16 +214,16 @@ open class MultipartFormData {
         //============================================================
         //============================================================
 
 
         #if !(os(Linux) || os(Windows))
         #if !(os(Linux) || os(Windows))
-        do {
-            let isReachable = try fileURL.checkPromisedItemIsReachable()
-            guard isReachable else {
-                setBodyPartError(withReason: .bodyPartFileNotReachable(at: fileURL))
+            do {
+                let isReachable = try fileURL.checkPromisedItemIsReachable()
+                guard isReachable else {
+                    setBodyPartError(withReason: .bodyPartFileNotReachable(at: fileURL))
+                    return
+                }
+            } catch {
+                setBodyPartError(withReason: .bodyPartFileNotReachableWithError(atURL: fileURL, error: error))
                 return
                 return
             }
             }
-        } catch {
-            setBodyPartError(withReason: .bodyPartFileNotReachableWithError(atURL: fileURL, error: error))
-            return
-        }
         #endif
         #endif
 
 
         //============================================================
         //============================================================
@@ -233,7 +233,7 @@ open class MultipartFormData {
         var isDirectory: ObjCBool = false
         var isDirectory: ObjCBool = false
         let path = fileURL.path
         let path = fileURL.path
 
 
-        guard fileManager.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory.boolValue else {
+        guard fileManager.fileExists(atPath: path, isDirectory: &isDirectory), !isDirectory.boolValue else {
             setBodyPartError(withReason: .bodyPartFileIsDirectory(at: fileURL))
             setBodyPartError(withReason: .bodyPartFileIsDirectory(at: fileURL))
             return
             return
         }
         }
@@ -287,7 +287,8 @@ open class MultipartFormData {
                        withLength length: UInt64,
                        withLength length: UInt64,
                        name: String,
                        name: String,
                        fileName: String,
                        fileName: String,
-                       mimeType: String) {
+                       mimeType: String)
+    {
         let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)
         let headers = contentHeaders(withName: name, fileName: fileName, mimeType: mimeType)
         append(stream, withLength: length, headers: headers)
         append(stream, withLength: length, headers: headers)
     }
     }
@@ -512,11 +513,12 @@ open class MultipartFormData {
 
 
     private func mimeType(forPathExtension pathExtension: String) -> String {
     private func mimeType(forPathExtension pathExtension: String) -> String {
         #if !(os(Linux) || os(Windows))
         #if !(os(Linux) || os(Windows))
-        if
-            let id = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as CFString, nil)?.takeRetainedValue(),
-            let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?.takeRetainedValue() {
-            return contentType as String
-        }
+            if
+                let id = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as CFString, nil)?.takeRetainedValue(),
+                let contentType = UTTypeCopyPreferredTagWithClass(id, kUTTagClassMIMEType)?.takeRetainedValue()
+            {
+                return contentType as String
+            }
         #endif
         #endif
 
 
         return "application/octet-stream"
         return "application/octet-stream"

+ 2 - 1
Example/Pods/Alamofire/Source/MultipartUpload.swift

@@ -36,7 +36,8 @@ final class MultipartUpload {
 
 
     init(encodingMemoryThreshold: UInt64,
     init(encodingMemoryThreshold: UInt64,
          request: URLRequestConvertible,
          request: URLRequestConvertible,
-         multipartFormData: MultipartFormData) {
+         multipartFormData: MultipartFormData)
+    {
         self.encodingMemoryThreshold = encodingMemoryThreshold
         self.encodingMemoryThreshold = encodingMemoryThreshold
         self.request = request
         self.request = request
         fileManager = multipartFormData.fileManager
         fileManager = multipartFormData.fileManager

+ 200 - 199
Example/Pods/Alamofire/Source/NetworkReachabilityManager.swift

@@ -24,244 +24,245 @@
 
 
 #if !(os(watchOS) || os(Linux) || os(Windows))
 #if !(os(watchOS) || os(Linux) || os(Windows))
 
 
-import Foundation
-import SystemConfiguration
-
-/// The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both cellular and
-/// WiFi network interfaces.
-///
-/// Reachability can be used to determine background information about why a network operation failed, or to retry
-/// network requests when a connection is established. It should not be used to prevent a user from initiating a network
-/// request, as it's possible that an initial request may be required to establish reachability.
-open class NetworkReachabilityManager {
-    /// Defines the various states of network reachability.
-    public enum NetworkReachabilityStatus {
-        /// It is unknown whether the network is reachable.
-        case unknown
-        /// The network is not reachable.
-        case notReachable
-        /// The network is reachable on the associated `ConnectionType`.
-        case reachable(ConnectionType)
-
-        init(_ flags: SCNetworkReachabilityFlags) {
-            guard flags.isActuallyReachable else { self = .notReachable; return }
-
-            var networkStatus: NetworkReachabilityStatus = .reachable(.ethernetOrWiFi)
-
-            if flags.isCellular { networkStatus = .reachable(.cellular) }
-
-            self = networkStatus
-        }
-
-        /// Defines the various connection types detected by reachability flags.
-        public enum ConnectionType {
-            /// The connection type is either over Ethernet or WiFi.
-            case ethernetOrWiFi
-            /// The connection type is a cellular connection.
-            case cellular
-        }
-    }
+    import Foundation
+    import SystemConfiguration
 
 
-    /// A closure executed when the network reachability status changes. The closure takes a single argument: the
-    /// network reachability status.
-    public typealias Listener = (NetworkReachabilityStatus) -> Void
+    /// The `NetworkReachabilityManager` class listens for reachability changes of hosts and addresses for both cellular and
+    /// WiFi network interfaces.
+    ///
+    /// Reachability can be used to determine background information about why a network operation failed, or to retry
+    /// network requests when a connection is established. It should not be used to prevent a user from initiating a network
+    /// request, as it's possible that an initial request may be required to establish reachability.
+    open class NetworkReachabilityManager {
+        /// Defines the various states of network reachability.
+        public enum NetworkReachabilityStatus {
+            /// It is unknown whether the network is reachable.
+            case unknown
+            /// The network is not reachable.
+            case notReachable
+            /// The network is reachable on the associated `ConnectionType`.
+            case reachable(ConnectionType)
+
+            init(_ flags: SCNetworkReachabilityFlags) {
+                guard flags.isActuallyReachable else { self = .notReachable; return }
+
+                var networkStatus: NetworkReachabilityStatus = .reachable(.ethernetOrWiFi)
+
+                if flags.isCellular { networkStatus = .reachable(.cellular) }
+
+                self = networkStatus
+            }
 
 
-    /// Default `NetworkReachabilityManager` for the zero address and a `listenerQueue` of `.main`.
-    public static let `default` = NetworkReachabilityManager()
+            /// Defines the various connection types detected by reachability flags.
+            public enum ConnectionType {
+                /// The connection type is either over Ethernet or WiFi.
+                case ethernetOrWiFi
+                /// The connection type is a cellular connection.
+                case cellular
+            }
+        }
 
 
-    // MARK: - Properties
+        /// A closure executed when the network reachability status changes. The closure takes a single argument: the
+        /// network reachability status.
+        public typealias Listener = (NetworkReachabilityStatus) -> Void
 
 
-    /// Whether the network is currently reachable.
-    open var isReachable: Bool { isReachableOnCellular || isReachableOnEthernetOrWiFi }
+        /// Default `NetworkReachabilityManager` for the zero address and a `listenerQueue` of `.main`.
+        public static let `default` = NetworkReachabilityManager()
 
 
-    /// Whether the network is currently reachable over the cellular interface.
-    ///
-    /// - Note: Using this property to decide whether to make a high or low bandwidth request is not recommended.
-    ///         Instead, set the `allowsCellularAccess` on any `URLRequest`s being issued.
-    ///
-    open var isReachableOnCellular: Bool { status == .reachable(.cellular) }
+        // MARK: - Properties
 
 
-    /// Whether the network is currently reachable over Ethernet or WiFi interface.
-    open var isReachableOnEthernetOrWiFi: Bool { status == .reachable(.ethernetOrWiFi) }
+        /// Whether the network is currently reachable.
+        open var isReachable: Bool { isReachableOnCellular || isReachableOnEthernetOrWiFi }
 
 
-    /// `DispatchQueue` on which reachability will update.
-    public let reachabilityQueue = DispatchQueue(label: "org.alamofire.reachabilityQueue")
+        /// Whether the network is currently reachable over the cellular interface.
+        ///
+        /// - Note: Using this property to decide whether to make a high or low bandwidth request is not recommended.
+        ///         Instead, set the `allowsCellularAccess` on any `URLRequest`s being issued.
+        ///
+        open var isReachableOnCellular: Bool { status == .reachable(.cellular) }
 
 
-    /// Flags of the current reachability type, if any.
-    open var flags: SCNetworkReachabilityFlags? {
-        var flags = SCNetworkReachabilityFlags()
+        /// Whether the network is currently reachable over Ethernet or WiFi interface.
+        open var isReachableOnEthernetOrWiFi: Bool { status == .reachable(.ethernetOrWiFi) }
 
 
-        return (SCNetworkReachabilityGetFlags(reachability, &flags)) ? flags : nil
-    }
+        /// `DispatchQueue` on which reachability will update.
+        public let reachabilityQueue = DispatchQueue(label: "org.alamofire.reachabilityQueue")
 
 
-    /// The current network reachability status.
-    open var status: NetworkReachabilityStatus {
-        flags.map(NetworkReachabilityStatus.init) ?? .unknown
-    }
+        /// Flags of the current reachability type, if any.
+        open var flags: SCNetworkReachabilityFlags? {
+            var flags = SCNetworkReachabilityFlags()
 
 
-    /// Mutable state storage.
-    struct MutableState {
-        /// A closure executed when the network reachability status changes.
-        var listener: Listener?
-        /// `DispatchQueue` on which listeners will be called.
-        var listenerQueue: DispatchQueue?
-        /// Previously calculated status.
-        var previousStatus: NetworkReachabilityStatus?
-    }
+            return (SCNetworkReachabilityGetFlags(reachability, &flags)) ? flags : nil
+        }
 
 
-    /// `SCNetworkReachability` instance providing notifications.
-    private let reachability: SCNetworkReachability
+        /// The current network reachability status.
+        open var status: NetworkReachabilityStatus {
+            flags.map(NetworkReachabilityStatus.init) ?? .unknown
+        }
 
 
-    /// Protected storage for mutable state.
-    @Protected
-    private var mutableState = MutableState()
+        /// Mutable state storage.
+        struct MutableState {
+            /// A closure executed when the network reachability status changes.
+            var listener: Listener?
+            /// `DispatchQueue` on which listeners will be called.
+            var listenerQueue: DispatchQueue?
+            /// Previously calculated status.
+            var previousStatus: NetworkReachabilityStatus?
+        }
 
 
-    // MARK: - Initialization
+        /// `SCNetworkReachability` instance providing notifications.
+        private let reachability: SCNetworkReachability
 
 
-    /// Creates an instance with the specified host.
-    ///
-    /// - Note: The `host` value must *not* contain a scheme, just the hostname.
-    ///
-    /// - Parameters:
-    ///   - host:          Host used to evaluate network reachability. Must *not* include the scheme (e.g. `https`).
-    public convenience init?(host: String) {
-        guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else { return nil }
+        /// Protected storage for mutable state.
+        @Protected
+        private var mutableState = MutableState()
 
 
-        self.init(reachability: reachability)
-    }
+        // MARK: - Initialization
 
 
-    /// Creates an instance that monitors the address 0.0.0.0.
-    ///
-    /// Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing
-    /// status of the device, both IPv4 and IPv6.
-    public convenience init?() {
-        var zero = sockaddr()
-        zero.sa_len = UInt8(MemoryLayout<sockaddr>.size)
-        zero.sa_family = sa_family_t(AF_INET)
+        /// Creates an instance with the specified host.
+        ///
+        /// - Note: The `host` value must *not* contain a scheme, just the hostname.
+        ///
+        /// - Parameters:
+        ///   - host:          Host used to evaluate network reachability. Must *not* include the scheme (e.g. `https`).
+        public convenience init?(host: String) {
+            guard let reachability = SCNetworkReachabilityCreateWithName(nil, host) else { return nil }
 
 
-        guard let reachability = SCNetworkReachabilityCreateWithAddress(nil, &zero) else { return nil }
+            self.init(reachability: reachability)
+        }
 
 
-        self.init(reachability: reachability)
-    }
+        /// Creates an instance that monitors the address 0.0.0.0.
+        ///
+        /// Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing
+        /// status of the device, both IPv4 and IPv6.
+        public convenience init?() {
+            var zero = sockaddr()
+            zero.sa_len = UInt8(MemoryLayout<sockaddr>.size)
+            zero.sa_family = sa_family_t(AF_INET)
 
 
-    private init(reachability: SCNetworkReachability) {
-        self.reachability = reachability
-    }
+            guard let reachability = SCNetworkReachabilityCreateWithAddress(nil, &zero) else { return nil }
 
 
-    deinit {
-        stopListening()
-    }
+            self.init(reachability: reachability)
+        }
 
 
-    // MARK: - Listening
+        private init(reachability: SCNetworkReachability) {
+            self.reachability = reachability
+        }
 
 
-    /// Starts listening for changes in network reachability status.
-    ///
-    /// - Note: Stops and removes any existing listener.
-    ///
-    /// - Parameters:
-    ///   - queue:    `DispatchQueue` on which to call the `listener` closure. `.main` by default.
-    ///   - listener: `Listener` closure called when reachability changes.
-    ///
-    /// - Returns: `true` if listening was started successfully, `false` otherwise.
-    @discardableResult
-    open func startListening(onQueue queue: DispatchQueue = .main,
-                             onUpdatePerforming listener: @escaping Listener) -> Bool {
-        stopListening()
-
-        $mutableState.write { state in
-            state.listenerQueue = queue
-            state.listener = listener
+        deinit {
+            stopListening()
         }
         }
 
 
-        var context = SCNetworkReachabilityContext(version: 0,
-                                                   info: Unmanaged.passUnretained(self).toOpaque(),
-                                                   retain: nil,
-                                                   release: nil,
-                                                   copyDescription: nil)
-        let callback: SCNetworkReachabilityCallBack = { _, flags, info in
-            guard let info = info else { return }
+        // MARK: - Listening
+
+        /// Starts listening for changes in network reachability status.
+        ///
+        /// - Note: Stops and removes any existing listener.
+        ///
+        /// - Parameters:
+        ///   - queue:    `DispatchQueue` on which to call the `listener` closure. `.main` by default.
+        ///   - listener: `Listener` closure called when reachability changes.
+        ///
+        /// - Returns: `true` if listening was started successfully, `false` otherwise.
+        @discardableResult
+        open func startListening(onQueue queue: DispatchQueue = .main,
+                                 onUpdatePerforming listener: @escaping Listener) -> Bool
+        {
+            stopListening()
+
+            $mutableState.write { state in
+                state.listenerQueue = queue
+                state.listener = listener
+            }
 
 
-            let instance = Unmanaged<NetworkReachabilityManager>.fromOpaque(info).takeUnretainedValue()
-            instance.notifyListener(flags)
-        }
+            var context = SCNetworkReachabilityContext(version: 0,
+                                                       info: Unmanaged.passUnretained(self).toOpaque(),
+                                                       retain: nil,
+                                                       release: nil,
+                                                       copyDescription: nil)
+            let callback: SCNetworkReachabilityCallBack = { _, flags, info in
+                guard let info = info else { return }
 
 
-        let queueAdded = SCNetworkReachabilitySetDispatchQueue(reachability, reachabilityQueue)
-        let callbackAdded = SCNetworkReachabilitySetCallback(reachability, callback, &context)
+                let instance = Unmanaged<NetworkReachabilityManager>.fromOpaque(info).takeUnretainedValue()
+                instance.notifyListener(flags)
+            }
 
 
-        // Manually call listener to give initial state, since the framework may not.
-        if let currentFlags = flags {
-            reachabilityQueue.async {
-                self.notifyListener(currentFlags)
+            let queueAdded = SCNetworkReachabilitySetDispatchQueue(reachability, reachabilityQueue)
+            let callbackAdded = SCNetworkReachabilitySetCallback(reachability, callback, &context)
+
+            // Manually call listener to give initial state, since the framework may not.
+            if let currentFlags = flags {
+                reachabilityQueue.async {
+                    self.notifyListener(currentFlags)
+                }
             }
             }
-        }
 
 
-        return callbackAdded && queueAdded
-    }
+            return callbackAdded && queueAdded
+        }
 
 
-    /// Stops listening for changes in network reachability status.
-    open func stopListening() {
-        SCNetworkReachabilitySetCallback(reachability, nil, nil)
-        SCNetworkReachabilitySetDispatchQueue(reachability, nil)
-        $mutableState.write { state in
-            state.listener = nil
-            state.listenerQueue = nil
-            state.previousStatus = nil
+        /// Stops listening for changes in network reachability status.
+        open func stopListening() {
+            SCNetworkReachabilitySetCallback(reachability, nil, nil)
+            SCNetworkReachabilitySetDispatchQueue(reachability, nil)
+            $mutableState.write { state in
+                state.listener = nil
+                state.listenerQueue = nil
+                state.previousStatus = nil
+            }
         }
         }
-    }
 
 
-    // MARK: - Internal - Listener Notification
+        // MARK: - Internal - Listener Notification
 
 
-    /// Calls the `listener` closure of the `listenerQueue` if the computed status hasn't changed.
-    ///
-    /// - Note: Should only be called from the `reachabilityQueue`.
-    ///
-    /// - Parameter flags: `SCNetworkReachabilityFlags` to use to calculate the status.
-    func notifyListener(_ flags: SCNetworkReachabilityFlags) {
-        let newStatus = NetworkReachabilityStatus(flags)
+        /// Calls the `listener` closure of the `listenerQueue` if the computed status hasn't changed.
+        ///
+        /// - Note: Should only be called from the `reachabilityQueue`.
+        ///
+        /// - Parameter flags: `SCNetworkReachabilityFlags` to use to calculate the status.
+        func notifyListener(_ flags: SCNetworkReachabilityFlags) {
+            let newStatus = NetworkReachabilityStatus(flags)
 
 
-        $mutableState.write { state in
-            guard state.previousStatus != newStatus else { return }
+            $mutableState.write { state in
+                guard state.previousStatus != newStatus else { return }
 
 
-            state.previousStatus = newStatus
+                state.previousStatus = newStatus
 
 
-            let listener = state.listener
-            state.listenerQueue?.async { listener?(newStatus) }
+                let listener = state.listener
+                state.listenerQueue?.async { listener?(newStatus) }
+            }
         }
         }
     }
     }
-}
-
-// MARK: -
-
-extension NetworkReachabilityManager.NetworkReachabilityStatus: Equatable {}
-
-extension SCNetworkReachabilityFlags {
-    var isReachable: Bool { contains(.reachable) }
-    var isConnectionRequired: Bool { contains(.connectionRequired) }
-    var canConnectAutomatically: Bool { contains(.connectionOnDemand) || contains(.connectionOnTraffic) }
-    var canConnectWithoutUserInteraction: Bool { canConnectAutomatically && !contains(.interventionRequired) }
-    var isActuallyReachable: Bool { isReachable && (!isConnectionRequired || canConnectWithoutUserInteraction) }
-    var isCellular: Bool {
-        #if os(iOS) || os(tvOS)
-        return contains(.isWWAN)
-        #else
-        return false
-        #endif
-    }
 
 
-    /// Human readable `String` for all states, to help with debugging.
-    var readableDescription: String {
-        let W = isCellular ? "W" : "-"
-        let R = isReachable ? "R" : "-"
-        let c = isConnectionRequired ? "c" : "-"
-        let t = contains(.transientConnection) ? "t" : "-"
-        let i = contains(.interventionRequired) ? "i" : "-"
-        let C = contains(.connectionOnTraffic) ? "C" : "-"
-        let D = contains(.connectionOnDemand) ? "D" : "-"
-        let l = contains(.isLocalAddress) ? "l" : "-"
-        let d = contains(.isDirect) ? "d" : "-"
-        let a = contains(.connectionAutomatic) ? "a" : "-"
-
-        return "\(W)\(R) \(c)\(t)\(i)\(C)\(D)\(l)\(d)\(a)"
+    // MARK: -
+
+    extension NetworkReachabilityManager.NetworkReachabilityStatus: Equatable {}
+
+    extension SCNetworkReachabilityFlags {
+        var isReachable: Bool { contains(.reachable) }
+        var isConnectionRequired: Bool { contains(.connectionRequired) }
+        var canConnectAutomatically: Bool { contains(.connectionOnDemand) || contains(.connectionOnTraffic) }
+        var canConnectWithoutUserInteraction: Bool { canConnectAutomatically && !contains(.interventionRequired) }
+        var isActuallyReachable: Bool { isReachable && (!isConnectionRequired || canConnectWithoutUserInteraction) }
+        var isCellular: Bool {
+            #if os(iOS) || os(tvOS)
+                return contains(.isWWAN)
+            #else
+                return false
+            #endif
+        }
+
+        /// Human readable `String` for all states, to help with debugging.
+        var readableDescription: String {
+            let W = isCellular ? "W" : "-"
+            let R = isReachable ? "R" : "-"
+            let c = isConnectionRequired ? "c" : "-"
+            let t = contains(.transientConnection) ? "t" : "-"
+            let i = contains(.interventionRequired) ? "i" : "-"
+            let C = contains(.connectionOnTraffic) ? "C" : "-"
+            let D = contains(.connectionOnDemand) ? "D" : "-"
+            let l = contains(.isLocalAddress) ? "l" : "-"
+            let d = contains(.isDirect) ? "d" : "-"
+            let a = contains(.connectionAutomatic) ? "a" : "-"
+
+            return "\(W)\(R) \(c)\(t)\(i)\(C)\(D)\(l)\(d)\(a)"
+        }
     }
     }
-}
 #endif
 #endif

+ 15 - 15
Example/Pods/Alamofire/Source/Notifications.swift

@@ -24,24 +24,24 @@
 
 
 import Foundation
 import Foundation
 
 
-extension Request {
+public extension Request {
     /// Posted when a `Request` is resumed. The `Notification` contains the resumed `Request`.
     /// Posted when a `Request` is resumed. The `Notification` contains the resumed `Request`.
-    public static let didResumeNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didResume")
+    static let didResumeNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didResume")
     /// Posted when a `Request` is suspended. The `Notification` contains the suspended `Request`.
     /// Posted when a `Request` is suspended. The `Notification` contains the suspended `Request`.
-    public static let didSuspendNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didSuspend")
+    static let didSuspendNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didSuspend")
     /// Posted when a `Request` is cancelled. The `Notification` contains the cancelled `Request`.
     /// Posted when a `Request` is cancelled. The `Notification` contains the cancelled `Request`.
-    public static let didCancelNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCancel")
+    static let didCancelNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCancel")
     /// Posted when a `Request` is finished. The `Notification` contains the completed `Request`.
     /// Posted when a `Request` is finished. The `Notification` contains the completed `Request`.
-    public static let didFinishNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didFinish")
+    static let didFinishNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didFinish")
 
 
     /// Posted when a `URLSessionTask` is resumed. The `Notification` contains the `Request` associated with the `URLSessionTask`.
     /// Posted when a `URLSessionTask` is resumed. The `Notification` contains the `Request` associated with the `URLSessionTask`.
-    public static let didResumeTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didResumeTask")
+    static let didResumeTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didResumeTask")
     /// Posted when a `URLSessionTask` is suspended. The `Notification` contains the `Request` associated with the `URLSessionTask`.
     /// Posted when a `URLSessionTask` is suspended. The `Notification` contains the `Request` associated with the `URLSessionTask`.
-    public static let didSuspendTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didSuspendTask")
+    static let didSuspendTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didSuspendTask")
     /// Posted when a `URLSessionTask` is cancelled. The `Notification` contains the `Request` associated with the `URLSessionTask`.
     /// Posted when a `URLSessionTask` is cancelled. The `Notification` contains the `Request` associated with the `URLSessionTask`.
-    public static let didCancelTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCancelTask")
+    static let didCancelTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCancelTask")
     /// Posted when a `URLSessionTask` is completed. The `Notification` contains the `Request` associated with the `URLSessionTask`.
     /// Posted when a `URLSessionTask` is completed. The `Notification` contains the `Request` associated with the `URLSessionTask`.
-    public static let didCompleteTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCompleteTask")
+    static let didCompleteTaskNotification = Notification.Name(rawValue: "org.alamofire.notification.name.request.didCompleteTask")
 }
 }
 
 
 // MARK: -
 // MARK: -
@@ -74,9 +74,9 @@ extension NotificationCenter {
     }
     }
 }
 }
 
 
-extension String {
+private extension String {
     /// User info dictionary key representing the `Request` associated with the notification.
     /// User info dictionary key representing the `Request` associated with the notification.
-    fileprivate static let requestKey = "org.alamofire.notification.key.request"
+    static let requestKey = "org.alamofire.notification.key.request"
 }
 }
 
 
 /// `EventMonitor` that provides Alamofire's notifications.
 /// `EventMonitor` that provides Alamofire's notifications.
@@ -97,19 +97,19 @@ public final class AlamofireNotifications: EventMonitor {
         NotificationCenter.default.postNotification(named: Request.didFinishNotification, with: request)
         NotificationCenter.default.postNotification(named: Request.didFinishNotification, with: request)
     }
     }
 
 
-    public func request(_ request: Request, didResumeTask task: URLSessionTask) {
+    public func request(_ request: Request, didResumeTask _: URLSessionTask) {
         NotificationCenter.default.postNotification(named: Request.didResumeTaskNotification, with: request)
         NotificationCenter.default.postNotification(named: Request.didResumeTaskNotification, with: request)
     }
     }
 
 
-    public func request(_ request: Request, didSuspendTask task: URLSessionTask) {
+    public func request(_ request: Request, didSuspendTask _: URLSessionTask) {
         NotificationCenter.default.postNotification(named: Request.didSuspendTaskNotification, with: request)
         NotificationCenter.default.postNotification(named: Request.didSuspendTaskNotification, with: request)
     }
     }
 
 
-    public func request(_ request: Request, didCancelTask task: URLSessionTask) {
+    public func request(_ request: Request, didCancelTask _: URLSessionTask) {
         NotificationCenter.default.postNotification(named: Request.didCancelTaskNotification, with: request)
         NotificationCenter.default.postNotification(named: Request.didCancelTaskNotification, with: request)
     }
     }
 
 
-    public func request(_ request: Request, didCompleteTask task: URLSessionTask, with error: AFError?) {
+    public func request(_ request: Request, didCompleteTask _: URLSessionTask, with _: AFError?) {
         NotificationCenter.default.postNotification(named: Request.didCompleteTaskNotification, with: request)
         NotificationCenter.default.postNotification(named: Request.didCompleteTaskNotification, with: request)
     }
     }
 }
 }

+ 2 - 1
Example/Pods/Alamofire/Source/OperationQueue+Alamofire.swift

@@ -38,7 +38,8 @@ extension OperationQueue {
                      maxConcurrentOperationCount: Int = OperationQueue.defaultMaxConcurrentOperationCount,
                      maxConcurrentOperationCount: Int = OperationQueue.defaultMaxConcurrentOperationCount,
                      underlyingQueue: DispatchQueue? = nil,
                      underlyingQueue: DispatchQueue? = nil,
                      name: String? = nil,
                      name: String? = nil,
-                     startSuspended: Bool = false) {
+                     startSuspended: Bool = false)
+    {
         self.init()
         self.init()
         self.qualityOfService = qualityOfService
         self.qualityOfService = qualityOfService
         self.maxConcurrentOperationCount = maxConcurrentOperationCount
         self.maxConcurrentOperationCount = maxConcurrentOperationCount

+ 6 - 3
Example/Pods/Alamofire/Source/ParameterEncoder.swift

@@ -73,7 +73,8 @@ open class JSONParameterEncoder: ParameterEncoder {
     }
     }
 
 
     open func encode<Parameters: Encodable>(_ parameters: Parameters?,
     open func encode<Parameters: Encodable>(_ parameters: Parameters?,
-                                            into request: URLRequest) throws -> URLRequest {
+                                            into request: URLRequest) throws -> URLRequest
+    {
         guard let parameters = parameters else { return request }
         guard let parameters = parameters else { return request }
 
 
         var request = request
         var request = request
@@ -144,7 +145,8 @@ open class URLEncodedFormParameterEncoder: ParameterEncoder {
     }
     }
 
 
     open func encode<Parameters: Encodable>(_ parameters: Parameters?,
     open func encode<Parameters: Encodable>(_ parameters: Parameters?,
-                                            into request: URLRequest) throws -> URLRequest {
+                                            into request: URLRequest) throws -> URLRequest
+    {
         guard let parameters = parameters else { return request }
         guard let parameters = parameters else { return request }
 
 
         var request = request
         var request = request
@@ -159,7 +161,8 @@ open class URLEncodedFormParameterEncoder: ParameterEncoder {
         }
         }
 
 
         if destination.encodesParametersInURL(for: method),
         if destination.encodesParametersInURL(for: method),
-           var components = URLComponents(url: url, resolvingAgainstBaseURL: false) {
+           var components = URLComponents(url: url, resolvingAgainstBaseURL: false)
+        {
             let query: String = try Result<String, Error> { try encoder.encode(parameters) }
             let query: String = try Result<String, Error> { try encoder.encode(parameters) }
                 .mapError { AFError.parameterEncoderFailed(reason: .encoderFailed(error: $0)) }.get()
                 .mapError { AFError.parameterEncoderFailed(reason: .encoderFailed(error: $0)) }.get()
             let newQueryString = [components.percentEncodedQuery, query].compactMap { $0 }.joinedWithAmpersands()
             let newQueryString = [components.percentEncodedQuery, query].compactMap { $0 }.joinedWithAmpersands()

+ 4 - 3
Example/Pods/Alamofire/Source/ParameterEncoding.swift

@@ -144,7 +144,8 @@ public struct URLEncoding: ParameterEncoding {
     ///   - boolEncoding:  `BoolEncoding` to use. `.numeric` by default.
     ///   - boolEncoding:  `BoolEncoding` to use. `.numeric` by default.
     public init(destination: Destination = .methodDependent,
     public init(destination: Destination = .methodDependent,
                 arrayEncoding: ArrayEncoding = .brackets,
                 arrayEncoding: ArrayEncoding = .brackets,
-                boolEncoding: BoolEncoding = .numeric) {
+                boolEncoding: BoolEncoding = .numeric)
+    {
         self.destination = destination
         self.destination = destination
         self.arrayEncoding = arrayEncoding
         self.arrayEncoding = arrayEncoding
         self.boolEncoding = boolEncoding
         self.boolEncoding = boolEncoding
@@ -308,8 +309,8 @@ public struct JSONEncoding: ParameterEncoding {
 
 
 // MARK: -
 // MARK: -
 
 
-extension NSNumber {
-    fileprivate var isBool: Bool {
+private extension NSNumber {
+    var isBool: Bool {
         // Use Obj-C type encoding to check whether the underlying type is a `Bool`, as it's guaranteed as part of
         // Use Obj-C type encoding to check whether the underlying type is a `Bool`, as it's guaranteed as part of
         // swift-corelibs-foundation, per [this discussion on the Swift forums](https://forums.swift.org/t/alamofire-on-linux-possible-but-not-release-ready/34553/22).
         // swift-corelibs-foundation, per [this discussion on the Swift forums](https://forums.swift.org/t/alamofire-on-linux-possible-but-not-release-ready/34553/22).
         String(cString: objCType) == "c"
         String(cString: objCType) == "c"

+ 20 - 20
Example/Pods/Alamofire/Source/Protected.swift

@@ -51,33 +51,33 @@ extension Lock {
 
 
 #if os(Linux) || os(Windows)
 #if os(Linux) || os(Windows)
 
 
-extension NSLock: Lock {}
+    extension NSLock: Lock {}
 
 
 #endif
 #endif
 
 
 #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
 #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
-/// An `os_unfair_lock` wrapper.
-final class UnfairLock: Lock {
-    private let unfairLock: os_unfair_lock_t
+    /// An `os_unfair_lock` wrapper.
+    final class UnfairLock: Lock {
+        private let unfairLock: os_unfair_lock_t
 
 
-    init() {
-        unfairLock = .allocate(capacity: 1)
-        unfairLock.initialize(to: os_unfair_lock())
-    }
+        init() {
+            unfairLock = .allocate(capacity: 1)
+            unfairLock.initialize(to: os_unfair_lock())
+        }
 
 
-    deinit {
-        unfairLock.deinitialize(count: 1)
-        unfairLock.deallocate()
-    }
+        deinit {
+            unfairLock.deinitialize(count: 1)
+            unfairLock.deallocate()
+        }
 
 
-    fileprivate func lock() {
-        os_unfair_lock_lock(unfairLock)
-    }
+        fileprivate func lock() {
+            os_unfair_lock_lock(unfairLock)
+        }
 
 
-    fileprivate func unlock() {
-        os_unfair_lock_unlock(unfairLock)
+        fileprivate func unlock() {
+            os_unfair_lock_unlock(unfairLock)
+        }
     }
     }
-}
 #endif
 #endif
 
 
 /// A thread-safe wrapper around a value.
 /// A thread-safe wrapper around a value.
@@ -85,9 +85,9 @@ final class UnfairLock: Lock {
 @dynamicMemberLookup
 @dynamicMemberLookup
 final class Protected<T> {
 final class Protected<T> {
     #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
     #if os(macOS) || os(iOS) || os(watchOS) || os(tvOS)
-    private let lock = UnfairLock()
+        private let lock = UnfairLock()
     #elseif os(Linux) || os(Windows)
     #elseif os(Linux) || os(Windows)
-    private let lock = NSLock()
+        private let lock = NSLock()
     #endif
     #endif
     private var value: T
     private var value: T
 
 

+ 2 - 1
Example/Pods/Alamofire/Source/RedirectHandler.swift

@@ -81,7 +81,8 @@ extension Redirector: RedirectHandler {
     public func task(_ task: URLSessionTask,
     public func task(_ task: URLSessionTask,
                      willBeRedirectedTo request: URLRequest,
                      willBeRedirectedTo request: URLRequest,
                      for response: HTTPURLResponse,
                      for response: HTTPURLResponse,
-                     completion: @escaping (URLRequest?) -> Void) {
+                     completion: @escaping (URLRequest?) -> Void)
+    {
         switch behavior {
         switch behavior {
         case .follow:
         case .follow:
             completion(request)
             completion(request)

+ 54 - 45
Example/Pods/Alamofire/Source/Request.swift

@@ -261,7 +261,8 @@ public class Request {
          serializationQueue: DispatchQueue,
          serializationQueue: DispatchQueue,
          eventMonitor: EventMonitor?,
          eventMonitor: EventMonitor?,
          interceptor: RequestInterceptor?,
          interceptor: RequestInterceptor?,
-         delegate: RequestDelegate) {
+         delegate: RequestDelegate)
+    {
         self.id = id
         self.id = id
         self.underlyingQueue = underlyingQueue
         self.underlyingQueue = underlyingQueue
         self.serializationQueue = serializationQueue
         self.serializationQueue = serializationQueue
@@ -650,7 +651,7 @@ public class Request {
     ///   - session: `URLSession` which creates the `URLSessionTask`.
     ///   - session: `URLSession` which creates the `URLSessionTask`.
     ///
     ///
     /// - Returns:   The `URLSessionTask` created.
     /// - Returns:   The `URLSessionTask` created.
-    func task(for request: URLRequest, using session: URLSession) -> URLSessionTask {
+    func task(for _: URLRequest, using _: URLSession) -> URLSessionTask {
         fatalError("Subclasses must override.")
         fatalError("Subclasses must override.")
     }
     }
 
 
@@ -930,7 +931,7 @@ public class Request {
 // MARK: - Protocol Conformances
 // MARK: - Protocol Conformances
 
 
 extension Request: Equatable {
 extension Request: Equatable {
-    public static func ==(lhs: Request, rhs: Request) -> Bool {
+    public static func == (lhs: Request, rhs: Request) -> Bool {
         lhs.id == rhs.id
         lhs.id == rhs.id
     }
     }
 }
 }
@@ -955,11 +956,11 @@ extension Request: CustomStringConvertible {
     }
     }
 }
 }
 
 
-extension Request {
+public extension Request {
     /// cURL representation of the instance.
     /// cURL representation of the instance.
     ///
     ///
     /// - Returns: The cURL equivalent of the instance.
     /// - Returns: The cURL equivalent of the instance.
-    public func cURLDescription() -> String {
+    func cURLDescription() -> String {
         guard
         guard
             let request = lastRequest,
             let request = lastRequest,
             let url = request.url,
             let url = request.url,
@@ -992,7 +993,8 @@ extension Request {
         if let configuration = delegate?.sessionConfiguration, configuration.httpShouldSetCookies {
         if let configuration = delegate?.sessionConfiguration, configuration.httpShouldSetCookies {
             if
             if
                 let cookieStorage = configuration.httpCookieStorage,
                 let cookieStorage = configuration.httpCookieStorage,
-                let cookies = cookieStorage.cookies(for: url), !cookies.isEmpty {
+                let cookies = cookieStorage.cookies(for: url), !cookies.isEmpty
+            {
                 let allCookies = cookies.map { "\($0.name)=\($0.value)" }.joined(separator: ";")
                 let allCookies = cookies.map { "\($0.name)=\($0.value)" }.joined(separator: ";")
 
 
                 components.append("-b \"\(allCookies)\"")
                 components.append("-b \"\(allCookies)\"")
@@ -1091,7 +1093,8 @@ public class DataRequest: Request {
          serializationQueue: DispatchQueue,
          serializationQueue: DispatchQueue,
          eventMonitor: EventMonitor?,
          eventMonitor: EventMonitor?,
          interceptor: RequestInterceptor?,
          interceptor: RequestInterceptor?,
-         delegate: RequestDelegate) {
+         delegate: RequestDelegate)
+    {
         self.convertible = convertible
         self.convertible = convertible
 
 
         super.init(id: id,
         super.init(id: id,
@@ -1271,7 +1274,8 @@ public final class DataStreamRequest: Request {
          serializationQueue: DispatchQueue,
          serializationQueue: DispatchQueue,
          eventMonitor: EventMonitor?,
          eventMonitor: EventMonitor?,
          interceptor: RequestInterceptor?,
          interceptor: RequestInterceptor?,
-         delegate: RequestDelegate) {
+         delegate: RequestDelegate)
+    {
         self.convertible = convertible
         self.convertible = convertible
         self.automaticallyCancelOnStreamError = automaticallyCancelOnStreamError
         self.automaticallyCancelOnStreamError = automaticallyCancelOnStreamError
 
 
@@ -1299,12 +1303,12 @@ public final class DataStreamRequest: Request {
     func didReceive(data: Data) {
     func didReceive(data: Data) {
         $streamMutableState.write { state in
         $streamMutableState.write { state in
             #if !(os(Linux) || os(Windows))
             #if !(os(Linux) || os(Windows))
-            if let stream = state.outputStream {
-                underlyingQueue.async {
-                    var bytes = Array(data)
-                    stream.write(&bytes, maxLength: bytes.count)
+                if let stream = state.outputStream {
+                    underlyingQueue.async {
+                        var bytes = Array(data)
+                        stream.write(&bytes, maxLength: bytes.count)
+                    }
                 }
                 }
-            }
             #endif
             #endif
             state.numberOfExecutingStreams += state.streams.count
             state.numberOfExecutingStreams += state.streams.count
             let localState = state
             let localState = state
@@ -1340,28 +1344,28 @@ public final class DataStreamRequest: Request {
     }
     }
 
 
     #if !(os(Linux) || os(Windows))
     #if !(os(Linux) || os(Windows))
-    /// Produces an `InputStream` that receives the `Data` received by the instance.
-    ///
-    /// - Note: The `InputStream` produced by this method must have `open()` called before being able to read `Data`.
-    ///         Additionally, this method will automatically call `resume()` on the instance, regardless of whether or
-    ///         not the creating session has `startRequestsImmediately` set to `true`.
-    ///
-    /// - Parameter bufferSize: Size, in bytes, of the buffer between the `OutputStream` and `InputStream`.
-    ///
-    /// - Returns:              The `InputStream` bound to the internal `OutboundStream`.
-    public func asInputStream(bufferSize: Int = 1024) -> InputStream? {
-        defer { resume() }
+        /// Produces an `InputStream` that receives the `Data` received by the instance.
+        ///
+        /// - Note: The `InputStream` produced by this method must have `open()` called before being able to read `Data`.
+        ///         Additionally, this method will automatically call `resume()` on the instance, regardless of whether or
+        ///         not the creating session has `startRequestsImmediately` set to `true`.
+        ///
+        /// - Parameter bufferSize: Size, in bytes, of the buffer between the `OutputStream` and `InputStream`.
+        ///
+        /// - Returns:              The `InputStream` bound to the internal `OutboundStream`.
+        public func asInputStream(bufferSize: Int = 1024) -> InputStream? {
+            defer { resume() }
+
+            var inputStream: InputStream?
+            $streamMutableState.write { state in
+                Foundation.Stream.getBoundStreams(withBufferSize: bufferSize,
+                                                  inputStream: &inputStream,
+                                                  outputStream: &state.outputStream)
+                state.outputStream?.open()
+            }
 
 
-        var inputStream: InputStream?
-        $streamMutableState.write { state in
-            Foundation.Stream.getBoundStreams(withBufferSize: bufferSize,
-                                              inputStream: &inputStream,
-                                              outputStream: &state.outputStream)
-            state.outputStream?.open()
+            return inputStream
         }
         }
-
-        return inputStream
-    }
     #endif
     #endif
 
 
     func capturingError(from closure: () throws -> Void) {
     func capturingError(from closure: () throws -> Void) {
@@ -1374,7 +1378,8 @@ public final class DataStreamRequest: Request {
     }
     }
 
 
     func appendStreamCompletion<Success, Failure>(on queue: DispatchQueue,
     func appendStreamCompletion<Success, Failure>(on queue: DispatchQueue,
-                                                  stream: @escaping Handler<Success, Failure>) {
+                                                  stream: @escaping Handler<Success, Failure>)
+    {
         appendResponseSerializer {
         appendResponseSerializer {
             self.underlyingQueue.async {
             self.underlyingQueue.async {
                 self.responseSerializerDidComplete {
                 self.responseSerializerDidComplete {
@@ -1395,7 +1400,8 @@ public final class DataStreamRequest: Request {
     }
     }
 
 
     func enqueueCompletion<Success, Failure>(on queue: DispatchQueue,
     func enqueueCompletion<Success, Failure>(on queue: DispatchQueue,
-                                             stream: @escaping Handler<Success, Failure>) {
+                                             stream: @escaping Handler<Success, Failure>)
+    {
         queue.async {
         queue.async {
             do {
             do {
                 let completion = Completion(request: self.request,
                 let completion = Completion(request: self.request,
@@ -1410,30 +1416,30 @@ public final class DataStreamRequest: Request {
     }
     }
 }
 }
 
 
-extension DataStreamRequest.Stream {
+public extension DataStreamRequest.Stream {
     /// Incoming `Result` values from `Event.stream`.
     /// Incoming `Result` values from `Event.stream`.
-    public var result: Result<Success, Failure>? {
+    var result: Result<Success, Failure>? {
         guard case let .stream(result) = event else { return nil }
         guard case let .stream(result) = event else { return nil }
 
 
         return result
         return result
     }
     }
 
 
     /// `Success` value of the instance, if any.
     /// `Success` value of the instance, if any.
-    public var value: Success? {
+    var value: Success? {
         guard case let .success(value) = result else { return nil }
         guard case let .success(value) = result else { return nil }
 
 
         return value
         return value
     }
     }
 
 
     /// `Failure` value of the instance, if any.
     /// `Failure` value of the instance, if any.
-    public var error: Failure? {
+    var error: Failure? {
         guard case let .failure(error) = result else { return nil }
         guard case let .failure(error) = result else { return nil }
 
 
         return error
         return error
     }
     }
 
 
     /// `Completion` value of the instance, if any.
     /// `Completion` value of the instance, if any.
-    public var completion: DataStreamRequest.Completion? {
+    var completion: DataStreamRequest.Completion? {
         guard case let .complete(completion) = event else { return nil }
         guard case let .complete(completion) = event else { return nil }
 
 
         return completion
         return completion
@@ -1482,7 +1488,8 @@ public class DownloadRequest: Request {
     /// - Returns: The `Destination` closure.
     /// - Returns: The `Destination` closure.
     public class func suggestedDownloadDestination(for directory: FileManager.SearchPathDirectory = .documentDirectory,
     public class func suggestedDownloadDestination(for directory: FileManager.SearchPathDirectory = .documentDirectory,
                                                    in domain: FileManager.SearchPathDomainMask = .userDomainMask,
                                                    in domain: FileManager.SearchPathDomainMask = .userDomainMask,
-                                                   options: Options = []) -> Destination {
+                                                   options: Options = []) -> Destination
+    {
         { temporaryURL, response in
         { temporaryURL, response in
             let directoryURLs = FileManager.default.urls(for: directory, in: domain)
             let directoryURLs = FileManager.default.urls(for: directory, in: domain)
             let url = directoryURLs.first?.appendingPathComponent(response.suggestedFilename!) ?? temporaryURL
             let url = directoryURLs.first?.appendingPathComponent(response.suggestedFilename!) ?? temporaryURL
@@ -1538,9 +1545,9 @@ public class DownloadRequest: Request {
     /// - Note: For more information about `resumeData`, see [Apple's documentation](https://developer.apple.com/documentation/foundation/urlsessiondownloadtask/1411634-cancel).
     /// - Note: For more information about `resumeData`, see [Apple's documentation](https://developer.apple.com/documentation/foundation/urlsessiondownloadtask/1411634-cancel).
     public var resumeData: Data? {
     public var resumeData: Data? {
         #if !(os(Linux) || os(Windows))
         #if !(os(Linux) || os(Windows))
-        return mutableDownloadState.resumeData ?? error?.downloadResumeData
+            return mutableDownloadState.resumeData ?? error?.downloadResumeData
         #else
         #else
-        return mutableDownloadState.resumeData
+            return mutableDownloadState.resumeData
         #endif
         #endif
     }
     }
 
 
@@ -1573,7 +1580,8 @@ public class DownloadRequest: Request {
          eventMonitor: EventMonitor?,
          eventMonitor: EventMonitor?,
          interceptor: RequestInterceptor?,
          interceptor: RequestInterceptor?,
          delegate: RequestDelegate,
          delegate: RequestDelegate,
-         destination: @escaping Destination) {
+         destination: @escaping Destination)
+    {
         self.downloadable = downloadable
         self.downloadable = downloadable
         self.destination = destination
         self.destination = destination
 
 
@@ -1790,7 +1798,8 @@ public class UploadRequest: DataRequest {
          eventMonitor: EventMonitor?,
          eventMonitor: EventMonitor?,
          interceptor: RequestInterceptor?,
          interceptor: RequestInterceptor?,
          fileManager: FileManager,
          fileManager: FileManager,
-         delegate: RequestDelegate) {
+         delegate: RequestDelegate)
+    {
         upload = convertible
         upload = convertible
         self.fileManager = fileManager
         self.fileManager = fileManager
 
 

+ 15 - 10
Example/Pods/Alamofire/Source/RequestInterceptor.swift

@@ -92,15 +92,16 @@ public protocol RequestRetrier {
 /// Type that provides both `RequestAdapter` and `RequestRetrier` functionality.
 /// Type that provides both `RequestAdapter` and `RequestRetrier` functionality.
 public protocol RequestInterceptor: RequestAdapter, RequestRetrier {}
 public protocol RequestInterceptor: RequestAdapter, RequestRetrier {}
 
 
-extension RequestInterceptor {
-    public func adapt(_ urlRequest: URLRequest, for session: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {
+public extension RequestInterceptor {
+    func adapt(_ urlRequest: URLRequest, for _: Session, completion: @escaping (Result<URLRequest, Error>) -> Void) {
         completion(.success(urlRequest))
         completion(.success(urlRequest))
     }
     }
 
 
-    public func retry(_ request: Request,
-                      for session: Session,
-                      dueTo error: Error,
-                      completion: @escaping (RetryResult) -> Void) {
+    func retry(_: Request,
+               for _: Session,
+               dueTo _: Error,
+               completion: @escaping (RetryResult) -> Void)
+    {
         completion(.doNotRetry)
         completion(.doNotRetry)
     }
     }
 }
 }
@@ -144,7 +145,8 @@ open class Retrier: RequestInterceptor {
     open func retry(_ request: Request,
     open func retry(_ request: Request,
                     for session: Session,
                     for session: Session,
                     dueTo error: Error,
                     dueTo error: Error,
-                    completion: @escaping (RetryResult) -> Void) {
+                    completion: @escaping (RetryResult) -> Void)
+    {
         retryHandler(request, session, error, completion)
         retryHandler(request, session, error, completion)
     }
     }
 }
 }
@@ -196,7 +198,8 @@ open class Interceptor: RequestInterceptor {
     private func adapt(_ urlRequest: URLRequest,
     private func adapt(_ urlRequest: URLRequest,
                        for session: Session,
                        for session: Session,
                        using adapters: [RequestAdapter],
                        using adapters: [RequestAdapter],
-                       completion: @escaping (Result<URLRequest, Error>) -> Void) {
+                       completion: @escaping (Result<URLRequest, Error>) -> Void)
+    {
         var pendingAdapters = adapters
         var pendingAdapters = adapters
 
 
         guard !pendingAdapters.isEmpty else { completion(.success(urlRequest)); return }
         guard !pendingAdapters.isEmpty else { completion(.success(urlRequest)); return }
@@ -216,7 +219,8 @@ open class Interceptor: RequestInterceptor {
     open func retry(_ request: Request,
     open func retry(_ request: Request,
                     for session: Session,
                     for session: Session,
                     dueTo error: Error,
                     dueTo error: Error,
-                    completion: @escaping (RetryResult) -> Void) {
+                    completion: @escaping (RetryResult) -> Void)
+    {
         retry(request, for: session, dueTo: error, using: retriers, completion: completion)
         retry(request, for: session, dueTo: error, using: retriers, completion: completion)
     }
     }
 
 
@@ -224,7 +228,8 @@ open class Interceptor: RequestInterceptor {
                        for session: Session,
                        for session: Session,
                        dueTo error: Error,
                        dueTo error: Error,
                        using retriers: [RequestRetrier],
                        using retriers: [RequestRetrier],
-                       completion: @escaping (RetryResult) -> Void) {
+                       completion: @escaping (RetryResult) -> Void)
+    {
         var pendingRetriers = retriers
         var pendingRetriers = retriers
 
 
         guard !pendingRetriers.isEmpty else { completion(.doNotRetry); return }
         guard !pendingRetriers.isEmpty else { completion(.doNotRetry); return }

+ 11 - 10
Example/Pods/Alamofire/Source/RequestTaskMap.swift

@@ -38,7 +38,8 @@ struct RequestTaskMap {
 
 
     init(tasksToRequests: [URLSessionTask: Request] = [:],
     init(tasksToRequests: [URLSessionTask: Request] = [:],
          requestsToTasks: [Request: URLSessionTask] = [:],
          requestsToTasks: [Request: URLSessionTask] = [:],
-         taskEvents: [URLSessionTask: (completed: Bool, metricsGathered: Bool)] = [:]) {
+         taskEvents: [URLSessionTask: (completed: Bool, metricsGathered: Bool)] = [:])
+    {
         self.tasksToRequests = tasksToRequests
         self.tasksToRequests = tasksToRequests
         self.requestsToTasks = requestsToTasks
         self.requestsToTasks = requestsToTasks
         self.taskEvents = taskEvents
         self.taskEvents = taskEvents
@@ -132,17 +133,17 @@ struct RequestTaskMap {
         switch (events.completed, events.metricsGathered) {
         switch (events.completed, events.metricsGathered) {
         case (true, _): fatalError("RequestTaskMap consistency error: duplicate completionReceivedForTask call.")
         case (true, _): fatalError("RequestTaskMap consistency error: duplicate completionReceivedForTask call.")
         #if os(Linux) // Linux doesn't gather metrics, so unconditionally remove the reference and return true.
         #if os(Linux) // Linux doesn't gather metrics, so unconditionally remove the reference and return true.
-        default: self[task] = nil; return true
+            default: self[task] = nil; return true
         #else
         #else
-        case (false, false):
-            if #available(macOS 10.12, iOS 10, watchOS 7, tvOS 10, *) {
-                taskEvents[task] = (completed: true, metricsGathered: false); return false
-            } else {
-                // watchOS < 7 doesn't gather metrics, so unconditionally remove the reference and return true.
+            case (false, false):
+                if #available(macOS 10.12, iOS 10, watchOS 7, tvOS 10, *) {
+                    taskEvents[task] = (completed: true, metricsGathered: false); return false
+                } else {
+                    // watchOS < 7 doesn't gather metrics, so unconditionally remove the reference and return true.
+                    self[task] = nil; return true
+                }
+            case (false, true):
                 self[task] = nil; return true
                 self[task] = nil; return true
-            }
-        case (false, true):
-            self[task] = nil; return true
         #endif
         #endif
         }
         }
     }
     }

+ 18 - 15
Example/Pods/Alamofire/Source/Response.swift

@@ -72,7 +72,8 @@ public struct DataResponse<Success, Failure: Error> {
                 data: Data?,
                 data: Data?,
                 metrics: URLSessionTaskMetrics?,
                 metrics: URLSessionTaskMetrics?,
                 serializationDuration: TimeInterval,
                 serializationDuration: TimeInterval,
-                result: Result<Success, Failure>) {
+                result: Result<Success, Failure>)
+    {
         self.request = request
         self.request = request
         self.response = response
         self.response = response
         self.data = data
         self.data = data
@@ -123,7 +124,7 @@ extension DataResponse: CustomStringConvertible, CustomDebugStringConvertible {
 
 
 // MARK: -
 // MARK: -
 
 
-extension DataResponse {
+public extension DataResponse {
     /// Evaluates the specified closure when the result of this `DataResponse` is a success, passing the unwrapped
     /// Evaluates the specified closure when the result of this `DataResponse` is a success, passing the unwrapped
     /// result value as a parameter.
     /// result value as a parameter.
     ///
     ///
@@ -136,7 +137,7 @@ extension DataResponse {
     ///
     ///
     /// - returns: A `DataResponse` whose result wraps the value returned by the given closure. If this instance's
     /// - returns: A `DataResponse` whose result wraps the value returned by the given closure. If this instance's
     ///            result is a failure, returns a response wrapping the same failure.
     ///            result is a failure, returns a response wrapping the same failure.
-    public func map<NewSuccess>(_ transform: (Success) -> NewSuccess) -> DataResponse<NewSuccess, Failure> {
+    func map<NewSuccess>(_ transform: (Success) -> NewSuccess) -> DataResponse<NewSuccess, Failure> {
         DataResponse<NewSuccess, Failure>(request: request,
         DataResponse<NewSuccess, Failure>(request: request,
                                           response: response,
                                           response: response,
                                           data: data,
                                           data: data,
@@ -159,7 +160,7 @@ extension DataResponse {
     ///
     ///
     /// - returns: A success or failure `DataResponse` depending on the result of the given closure. If this instance's
     /// - returns: A success or failure `DataResponse` depending on the result of the given closure. If this instance's
     ///            result is a failure, returns the same failure.
     ///            result is a failure, returns the same failure.
-    public func tryMap<NewSuccess>(_ transform: (Success) throws -> NewSuccess) -> DataResponse<NewSuccess, Error> {
+    func tryMap<NewSuccess>(_ transform: (Success) throws -> NewSuccess) -> DataResponse<NewSuccess, Error> {
         DataResponse<NewSuccess, Error>(request: request,
         DataResponse<NewSuccess, Error>(request: request,
                                         response: response,
                                         response: response,
                                         data: data,
                                         data: data,
@@ -178,7 +179,7 @@ extension DataResponse {
     /// - Parameter transform: A closure that takes the error of the instance.
     /// - Parameter transform: A closure that takes the error of the instance.
     ///
     ///
     /// - Returns: A `DataResponse` instance containing the result of the transform.
     /// - Returns: A `DataResponse` instance containing the result of the transform.
-    public func mapError<NewFailure: Error>(_ transform: (Failure) -> NewFailure) -> DataResponse<Success, NewFailure> {
+    func mapError<NewFailure: Error>(_ transform: (Failure) -> NewFailure) -> DataResponse<Success, NewFailure> {
         DataResponse<Success, NewFailure>(request: request,
         DataResponse<Success, NewFailure>(request: request,
                                           response: response,
                                           response: response,
                                           data: data,
                                           data: data,
@@ -199,7 +200,7 @@ extension DataResponse {
     /// - Parameter transform: A throwing closure that takes the error of the instance.
     /// - Parameter transform: A throwing closure that takes the error of the instance.
     ///
     ///
     /// - Returns: A `DataResponse` instance containing the result of the transform.
     /// - Returns: A `DataResponse` instance containing the result of the transform.
-    public func tryMapError<NewFailure: Error>(_ transform: (Failure) throws -> NewFailure) -> DataResponse<Success, Error> {
+    func tryMapError<NewFailure: Error>(_ transform: (Failure) throws -> NewFailure) -> DataResponse<Success, Error> {
         DataResponse<Success, Error>(request: request,
         DataResponse<Success, Error>(request: request,
                                      response: response,
                                      response: response,
                                      data: data,
                                      data: data,
@@ -260,7 +261,8 @@ public struct DownloadResponse<Success, Failure: Error> {
                 resumeData: Data?,
                 resumeData: Data?,
                 metrics: URLSessionTaskMetrics?,
                 metrics: URLSessionTaskMetrics?,
                 serializationDuration: TimeInterval,
                 serializationDuration: TimeInterval,
-                result: Result<Success, Failure>) {
+                result: Result<Success, Failure>)
+    {
         self.request = request
         self.request = request
         self.response = response
         self.response = response
         self.fileURL = fileURL
         self.fileURL = fileURL
@@ -305,7 +307,7 @@ extension DownloadResponse: CustomStringConvertible, CustomDebugStringConvertibl
 
 
 // MARK: -
 // MARK: -
 
 
-extension DownloadResponse {
+public extension DownloadResponse {
     /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped
     /// Evaluates the given closure when the result of this `DownloadResponse` is a success, passing the unwrapped
     /// result value as a parameter.
     /// result value as a parameter.
     ///
     ///
@@ -318,7 +320,7 @@ extension DownloadResponse {
     ///
     ///
     /// - returns: A `DownloadResponse` whose result wraps the value returned by the given closure. If this instance's
     /// - returns: A `DownloadResponse` whose result wraps the value returned by the given closure. If this instance's
     ///            result is a failure, returns a response wrapping the same failure.
     ///            result is a failure, returns a response wrapping the same failure.
-    public func map<NewSuccess>(_ transform: (Success) -> NewSuccess) -> DownloadResponse<NewSuccess, Failure> {
+    func map<NewSuccess>(_ transform: (Success) -> NewSuccess) -> DownloadResponse<NewSuccess, Failure> {
         DownloadResponse<NewSuccess, Failure>(request: request,
         DownloadResponse<NewSuccess, Failure>(request: request,
                                               response: response,
                                               response: response,
                                               fileURL: fileURL,
                                               fileURL: fileURL,
@@ -342,7 +344,7 @@ extension DownloadResponse {
     ///
     ///
     /// - returns: A success or failure `DownloadResponse` depending on the result of the given closure. If this
     /// - returns: A success or failure `DownloadResponse` depending on the result of the given closure. If this
     /// instance's result is a failure, returns the same failure.
     /// instance's result is a failure, returns the same failure.
-    public func tryMap<NewSuccess>(_ transform: (Success) throws -> NewSuccess) -> DownloadResponse<NewSuccess, Error> {
+    func tryMap<NewSuccess>(_ transform: (Success) throws -> NewSuccess) -> DownloadResponse<NewSuccess, Error> {
         DownloadResponse<NewSuccess, Error>(request: request,
         DownloadResponse<NewSuccess, Error>(request: request,
                                             response: response,
                                             response: response,
                                             fileURL: fileURL,
                                             fileURL: fileURL,
@@ -362,7 +364,7 @@ extension DownloadResponse {
     /// - Parameter transform: A closure that takes the error of the instance.
     /// - Parameter transform: A closure that takes the error of the instance.
     ///
     ///
     /// - Returns: A `DownloadResponse` instance containing the result of the transform.
     /// - Returns: A `DownloadResponse` instance containing the result of the transform.
-    public func mapError<NewFailure: Error>(_ transform: (Failure) -> NewFailure) -> DownloadResponse<Success, NewFailure> {
+    func mapError<NewFailure: Error>(_ transform: (Failure) -> NewFailure) -> DownloadResponse<Success, NewFailure> {
         DownloadResponse<Success, NewFailure>(request: request,
         DownloadResponse<Success, NewFailure>(request: request,
                                               response: response,
                                               response: response,
                                               fileURL: fileURL,
                                               fileURL: fileURL,
@@ -384,7 +386,7 @@ extension DownloadResponse {
     /// - Parameter transform: A throwing closure that takes the error of the instance.
     /// - Parameter transform: A throwing closure that takes the error of the instance.
     ///
     ///
     /// - Returns: A `DownloadResponse` instance containing the result of the transform.
     /// - Returns: A `DownloadResponse` instance containing the result of the transform.
-    public func tryMapError<NewFailure: Error>(_ transform: (Failure) throws -> NewFailure) -> DownloadResponse<Success, Error> {
+    func tryMapError<NewFailure: Error>(_ transform: (Failure) throws -> NewFailure) -> DownloadResponse<Success, Error> {
         DownloadResponse<Success, Error>(request: request,
         DownloadResponse<Success, Error>(request: request,
                                          response: response,
                                          response: response,
                                          fileURL: fileURL,
                                          fileURL: fileURL,
@@ -429,7 +431,8 @@ private enum DebugDescription {
     static func description(for data: Data?,
     static func description(for data: Data?,
                             headers: HTTPHeaders,
                             headers: HTTPHeaders,
                             allowingPrintableTypes printableTypes: [String] = ["json", "xml", "text"],
                             allowingPrintableTypes printableTypes: [String] = ["json", "xml", "text"],
-                            maximumLength: Int = 100_000) -> String {
+                            maximumLength: Int = 100_000) -> String
+    {
         guard let data = data, !data.isEmpty else { return "[Body]: None" }
         guard let data = data, !data.isEmpty else { return "[Body]: None" }
 
 
         guard
         guard
@@ -446,8 +449,8 @@ private enum DebugDescription {
     }
     }
 }
 }
 
 
-extension String {
-    fileprivate func indentingNewlines(by spaceCount: Int = 4) -> String {
+private extension String {
+    func indentingNewlines(by spaceCount: Int = 4) -> String {
         let spaces = String(repeating: " ", count: spaceCount)
         let spaces = String(repeating: " ", count: spaceCount)
         return replacingOccurrences(of: "\n", with: "\n\(spaces)")
         return replacingOccurrences(of: "\n", with: "\n\(spaces)")
     }
     }

+ 124 - 104
Example/Pods/Alamofire/Source/ResponseSerialization.swift

@@ -95,24 +95,24 @@ public struct GoogleXSSIPreprocessor: DataPreprocessor {
     }
     }
 }
 }
 
 
-extension ResponseSerializer {
+public extension ResponseSerializer {
     /// Default `DataPreprocessor`. `PassthroughPreprocessor` by default.
     /// Default `DataPreprocessor`. `PassthroughPreprocessor` by default.
-    public static var defaultDataPreprocessor: DataPreprocessor { PassthroughPreprocessor() }
+    static var defaultDataPreprocessor: DataPreprocessor { PassthroughPreprocessor() }
     /// Default `HTTPMethod`s for which empty response bodies are considered appropriate. `[.head]` by default.
     /// Default `HTTPMethod`s for which empty response bodies are considered appropriate. `[.head]` by default.
-    public static var defaultEmptyRequestMethods: Set<HTTPMethod> { [.head] }
+    static var defaultEmptyRequestMethods: Set<HTTPMethod> { [.head] }
     /// HTTP response codes for which empty response bodies are considered appropriate. `[204, 205]` by default.
     /// HTTP response codes for which empty response bodies are considered appropriate. `[204, 205]` by default.
-    public static var defaultEmptyResponseCodes: Set<Int> { [204, 205] }
+    static var defaultEmptyResponseCodes: Set<Int> { [204, 205] }
 
 
-    public var dataPreprocessor: DataPreprocessor { Self.defaultDataPreprocessor }
-    public var emptyRequestMethods: Set<HTTPMethod> { Self.defaultEmptyRequestMethods }
-    public var emptyResponseCodes: Set<Int> { Self.defaultEmptyResponseCodes }
+    var dataPreprocessor: DataPreprocessor { Self.defaultDataPreprocessor }
+    var emptyRequestMethods: Set<HTTPMethod> { Self.defaultEmptyRequestMethods }
+    var emptyResponseCodes: Set<Int> { Self.defaultEmptyResponseCodes }
 
 
     /// Determines whether the `request` allows empty response bodies, if `request` exists.
     /// Determines whether the `request` allows empty response bodies, if `request` exists.
     ///
     ///
     /// - Parameter request: `URLRequest` to evaluate.
     /// - Parameter request: `URLRequest` to evaluate.
     ///
     ///
     /// - Returns:           `Bool` representing the outcome of the evaluation, or `nil` if `request` was `nil`.
     /// - Returns:           `Bool` representing the outcome of the evaluation, or `nil` if `request` was `nil`.
-    public func requestAllowsEmptyResponseData(_ request: URLRequest?) -> Bool? {
+    func requestAllowsEmptyResponseData(_ request: URLRequest?) -> Bool? {
         request.flatMap { $0.httpMethod }
         request.flatMap { $0.httpMethod }
             .flatMap(HTTPMethod.init)
             .flatMap(HTTPMethod.init)
             .map { emptyRequestMethods.contains($0) }
             .map { emptyRequestMethods.contains($0) }
@@ -123,7 +123,7 @@ extension ResponseSerializer {
     /// - Parameter response: `HTTPURLResponse` to evaluate.
     /// - Parameter response: `HTTPURLResponse` to evaluate.
     ///
     ///
     /// - Returns:            `Bool` representing the outcome of the evaluation, or `nil` if `response` was `nil`.
     /// - Returns:            `Bool` representing the outcome of the evaluation, or `nil` if `response` was `nil`.
-    public func responseAllowsEmptyResponseData(_ response: HTTPURLResponse?) -> Bool? {
+    func responseAllowsEmptyResponseData(_ response: HTTPURLResponse?) -> Bool? {
         response.flatMap { $0.statusCode }
         response.flatMap { $0.statusCode }
             .map { emptyResponseCodes.contains($0) }
             .map { emptyResponseCodes.contains($0) }
     }
     }
@@ -135,15 +135,15 @@ extension ResponseSerializer {
     ///   - response: `HTTPURLResponse` to evaluate.
     ///   - response: `HTTPURLResponse` to evaluate.
     ///
     ///
     /// - Returns:    `true` if `request` or `response` allow empty bodies, `false` otherwise.
     /// - Returns:    `true` if `request` or `response` allow empty bodies, `false` otherwise.
-    public func emptyResponseAllowed(forRequest request: URLRequest?, response: HTTPURLResponse?) -> Bool {
+    func emptyResponseAllowed(forRequest request: URLRequest?, response: HTTPURLResponse?) -> Bool {
         (requestAllowsEmptyResponseData(request) == true) || (responseAllowsEmptyResponseData(response) == true)
         (requestAllowsEmptyResponseData(request) == true) || (responseAllowsEmptyResponseData(response) == true)
     }
     }
 }
 }
 
 
 /// By default, any serializer declared to conform to both types will get file serialization for free, as it just feeds
 /// By default, any serializer declared to conform to both types will get file serialization for free, as it just feeds
 /// the data read from disk into the data response serializer.
 /// the data read from disk into the data response serializer.
-extension DownloadResponseSerializerProtocol where Self: DataResponseSerializerProtocol {
-    public func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> Self.SerializedObject {
+public extension DownloadResponseSerializerProtocol where Self: DataResponseSerializerProtocol {
+    func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> Self.SerializedObject {
         guard error == nil else { throw error! }
         guard error == nil else { throw error! }
 
 
         guard let fileURL = fileURL else {
         guard let fileURL = fileURL else {
@@ -167,7 +167,7 @@ extension DownloadResponseSerializerProtocol where Self: DataResponseSerializerP
 
 
 // MARK: - Default
 // MARK: - Default
 
 
-extension DataRequest {
+public extension DataRequest {
     /// Adds a handler to be called once the request has finished.
     /// Adds a handler to be called once the request has finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -176,7 +176,7 @@ extension DataRequest {
     ///
     ///
     /// - Returns:             The request.
     /// - Returns:             The request.
     @discardableResult
     @discardableResult
-    public func response(queue: DispatchQueue = .main, completionHandler: @escaping (AFDataResponse<Data?>) -> Void) -> Self {
+    func response(queue: DispatchQueue = .main, completionHandler: @escaping (AFDataResponse<Data?>) -> Void) -> Self {
         appendResponseSerializer {
         appendResponseSerializer {
             // Start work that should be on the serialization queue.
             // Start work that should be on the serialization queue.
             let result = AFResult<Data?>(value: self.data, error: self.error)
             let result = AFResult<Data?>(value: self.data, error: self.error)
@@ -208,10 +208,11 @@ extension DataRequest {
     ///
     ///
     /// - Returns:              The request.
     /// - Returns:              The request.
     @discardableResult
     @discardableResult
-    public func response<Serializer: DataResponseSerializerProtocol>(queue: DispatchQueue = .main,
-                                                                     responseSerializer: Serializer,
-                                                                     completionHandler: @escaping (AFDataResponse<Serializer.SerializedObject>) -> Void)
-        -> Self {
+    func response<Serializer: DataResponseSerializerProtocol>(queue: DispatchQueue = .main,
+                                                              responseSerializer: Serializer,
+                                                              completionHandler: @escaping (AFDataResponse<Serializer.SerializedObject>) -> Void)
+        -> Self
+    {
         appendResponseSerializer {
         appendResponseSerializer {
             // Start work that should be on the serialization queue.
             // Start work that should be on the serialization queue.
             let start = ProcessInfo.processInfo.systemUptime
             let start = ProcessInfo.processInfo.systemUptime
@@ -278,7 +279,7 @@ extension DataRequest {
     }
     }
 }
 }
 
 
-extension DownloadRequest {
+public extension DownloadRequest {
     /// Adds a handler to be called once the request has finished.
     /// Adds a handler to be called once the request has finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -287,9 +288,10 @@ extension DownloadRequest {
     ///
     ///
     /// - Returns:             The request.
     /// - Returns:             The request.
     @discardableResult
     @discardableResult
-    public func response(queue: DispatchQueue = .main,
-                         completionHandler: @escaping (AFDownloadResponse<URL?>) -> Void)
-        -> Self {
+    func response(queue: DispatchQueue = .main,
+                  completionHandler: @escaping (AFDownloadResponse<URL?>) -> Void)
+        -> Self
+    {
         appendResponseSerializer {
         appendResponseSerializer {
             // Start work that should be on the serialization queue.
             // Start work that should be on the serialization queue.
             let result = AFResult<URL?>(value: self.fileURL, error: self.error)
             let result = AFResult<URL?>(value: self.fileURL, error: self.error)
@@ -323,10 +325,11 @@ extension DownloadRequest {
     ///
     ///
     /// - Returns:              The request.
     /// - Returns:              The request.
     @discardableResult
     @discardableResult
-    public func response<Serializer: DownloadResponseSerializerProtocol>(queue: DispatchQueue = .main,
-                                                                         responseSerializer: Serializer,
-                                                                         completionHandler: @escaping (AFDownloadResponse<Serializer.SerializedObject>) -> Void)
-        -> Self {
+    func response<Serializer: DownloadResponseSerializerProtocol>(queue: DispatchQueue = .main,
+                                                                  responseSerializer: Serializer,
+                                                                  completionHandler: @escaping (AFDownloadResponse<Serializer.SerializedObject>) -> Void)
+        -> Self
+    {
         appendResponseSerializer {
         appendResponseSerializer {
             // Start work that should be on the serialization queue.
             // Start work that should be on the serialization queue.
             let start = ProcessInfo.processInfo.systemUptime
             let start = ProcessInfo.processInfo.systemUptime
@@ -402,10 +405,11 @@ public struct URLResponseSerializer: DownloadResponseSerializerProtocol {
     /// Creates an instance.
     /// Creates an instance.
     public init() {}
     public init() {}
 
 
-    public func serializeDownload(request: URLRequest?,
-                                  response: HTTPURLResponse?,
+    public func serializeDownload(request _: URLRequest?,
+                                  response _: HTTPURLResponse?,
                                   fileURL: URL?,
                                   fileURL: URL?,
-                                  error: Error?) throws -> URL {
+                                  error: Error?) throws -> URL
+    {
         guard error == nil else { throw error! }
         guard error == nil else { throw error! }
 
 
         guard let url = fileURL else {
         guard let url = fileURL else {
@@ -416,7 +420,7 @@ public struct URLResponseSerializer: DownloadResponseSerializerProtocol {
     }
     }
 }
 }
 
 
-extension DownloadRequest {
+public extension DownloadRequest {
     /// Adds a handler using a `URLResponseSerializer` to be called once the request is finished.
     /// Adds a handler using a `URLResponseSerializer` to be called once the request is finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -425,8 +429,9 @@ extension DownloadRequest {
     ///
     ///
     /// - Returns:             The request.
     /// - Returns:             The request.
     @discardableResult
     @discardableResult
-    public func responseURL(queue: DispatchQueue = .main,
-                            completionHandler: @escaping (AFDownloadResponse<URL>) -> Void) -> Self {
+    func responseURL(queue: DispatchQueue = .main,
+                     completionHandler: @escaping (AFDownloadResponse<URL>) -> Void) -> Self
+    {
         response(queue: queue, responseSerializer: URLResponseSerializer(), completionHandler: completionHandler)
         response(queue: queue, responseSerializer: URLResponseSerializer(), completionHandler: completionHandler)
     }
     }
 }
 }
@@ -449,7 +454,8 @@ public final class DataResponseSerializer: ResponseSerializer {
     ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.
     ///   - emptyRequestMethods: The HTTP request methods for which empty responses are allowed. `[.head]` by default.
     public init(dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
     public init(dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
                 emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
                 emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
-                emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods) {
+                emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods)
+    {
         self.dataPreprocessor = dataPreprocessor
         self.dataPreprocessor = dataPreprocessor
         self.emptyResponseCodes = emptyResponseCodes
         self.emptyResponseCodes = emptyResponseCodes
         self.emptyRequestMethods = emptyRequestMethods
         self.emptyRequestMethods = emptyRequestMethods
@@ -472,7 +478,7 @@ public final class DataResponseSerializer: ResponseSerializer {
     }
     }
 }
 }
 
 
-extension DataRequest {
+public extension DataRequest {
     /// Adds a handler using a `DataResponseSerializer` to be called once the request has finished.
     /// Adds a handler using a `DataResponseSerializer` to be called once the request has finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -485,11 +491,12 @@ extension DataRequest {
     ///
     ///
     /// - Returns:               The request.
     /// - Returns:               The request.
     @discardableResult
     @discardableResult
-    public func responseData(queue: DispatchQueue = .main,
-                             dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
-                             emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
-                             emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods,
-                             completionHandler: @escaping (AFDataResponse<Data>) -> Void) -> Self {
+    func responseData(queue: DispatchQueue = .main,
+                      dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
+                      emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
+                      emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods,
+                      completionHandler: @escaping (AFDataResponse<Data>) -> Void) -> Self
+    {
         response(queue: queue,
         response(queue: queue,
                  responseSerializer: DataResponseSerializer(dataPreprocessor: dataPreprocessor,
                  responseSerializer: DataResponseSerializer(dataPreprocessor: dataPreprocessor,
                                                             emptyResponseCodes: emptyResponseCodes,
                                                             emptyResponseCodes: emptyResponseCodes,
@@ -498,7 +505,7 @@ extension DataRequest {
     }
     }
 }
 }
 
 
-extension DownloadRequest {
+public extension DownloadRequest {
     /// Adds a handler using a `DataResponseSerializer` to be called once the request has finished.
     /// Adds a handler using a `DataResponseSerializer` to be called once the request has finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -511,11 +518,12 @@ extension DownloadRequest {
     ///
     ///
     /// - Returns:               The request.
     /// - Returns:               The request.
     @discardableResult
     @discardableResult
-    public func responseData(queue: DispatchQueue = .main,
-                             dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
-                             emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
-                             emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods,
-                             completionHandler: @escaping (AFDownloadResponse<Data>) -> Void) -> Self {
+    func responseData(queue: DispatchQueue = .main,
+                      dataPreprocessor: DataPreprocessor = DataResponseSerializer.defaultDataPreprocessor,
+                      emptyResponseCodes: Set<Int> = DataResponseSerializer.defaultEmptyResponseCodes,
+                      emptyRequestMethods: Set<HTTPMethod> = DataResponseSerializer.defaultEmptyRequestMethods,
+                      completionHandler: @escaping (AFDownloadResponse<Data>) -> Void) -> Self
+    {
         response(queue: queue,
         response(queue: queue,
                  responseSerializer: DataResponseSerializer(dataPreprocessor: dataPreprocessor,
                  responseSerializer: DataResponseSerializer(dataPreprocessor: dataPreprocessor,
                                                             emptyResponseCodes: emptyResponseCodes,
                                                             emptyResponseCodes: emptyResponseCodes,
@@ -547,7 +555,8 @@ public final class StringResponseSerializer: ResponseSerializer {
     public init(dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
     public init(dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
                 encoding: String.Encoding? = nil,
                 encoding: String.Encoding? = nil,
                 emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
                 emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
-                emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods) {
+                emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods)
+    {
         self.dataPreprocessor = dataPreprocessor
         self.dataPreprocessor = dataPreprocessor
         self.encoding = encoding
         self.encoding = encoding
         self.emptyResponseCodes = emptyResponseCodes
         self.emptyResponseCodes = emptyResponseCodes
@@ -583,7 +592,7 @@ public final class StringResponseSerializer: ResponseSerializer {
     }
     }
 }
 }
 
 
-extension DataRequest {
+public extension DataRequest {
     /// Adds a handler using a `StringResponseSerializer` to be called once the request has finished.
     /// Adds a handler using a `StringResponseSerializer` to be called once the request has finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -598,12 +607,13 @@ extension DataRequest {
     ///
     ///
     /// - Returns:               The request.
     /// - Returns:               The request.
     @discardableResult
     @discardableResult
-    public func responseString(queue: DispatchQueue = .main,
-                               dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
-                               encoding: String.Encoding? = nil,
-                               emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
-                               emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods,
-                               completionHandler: @escaping (AFDataResponse<String>) -> Void) -> Self {
+    func responseString(queue: DispatchQueue = .main,
+                        dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
+                        encoding: String.Encoding? = nil,
+                        emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
+                        emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods,
+                        completionHandler: @escaping (AFDataResponse<String>) -> Void) -> Self
+    {
         response(queue: queue,
         response(queue: queue,
                  responseSerializer: StringResponseSerializer(dataPreprocessor: dataPreprocessor,
                  responseSerializer: StringResponseSerializer(dataPreprocessor: dataPreprocessor,
                                                               encoding: encoding,
                                                               encoding: encoding,
@@ -613,7 +623,7 @@ extension DataRequest {
     }
     }
 }
 }
 
 
-extension DownloadRequest {
+public extension DownloadRequest {
     /// Adds a handler using a `StringResponseSerializer` to be called once the request has finished.
     /// Adds a handler using a `StringResponseSerializer` to be called once the request has finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -628,12 +638,13 @@ extension DownloadRequest {
     ///
     ///
     /// - Returns:               The request.
     /// - Returns:               The request.
     @discardableResult
     @discardableResult
-    public func responseString(queue: DispatchQueue = .main,
-                               dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
-                               encoding: String.Encoding? = nil,
-                               emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
-                               emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods,
-                               completionHandler: @escaping (AFDownloadResponse<String>) -> Void) -> Self {
+    func responseString(queue: DispatchQueue = .main,
+                        dataPreprocessor: DataPreprocessor = StringResponseSerializer.defaultDataPreprocessor,
+                        encoding: String.Encoding? = nil,
+                        emptyResponseCodes: Set<Int> = StringResponseSerializer.defaultEmptyResponseCodes,
+                        emptyRequestMethods: Set<HTTPMethod> = StringResponseSerializer.defaultEmptyRequestMethods,
+                        completionHandler: @escaping (AFDownloadResponse<String>) -> Void) -> Self
+    {
         response(queue: queue,
         response(queue: queue,
                  responseSerializer: StringResponseSerializer(dataPreprocessor: dataPreprocessor,
                  responseSerializer: StringResponseSerializer(dataPreprocessor: dataPreprocessor,
                                                               encoding: encoding,
                                                               encoding: encoding,
@@ -665,7 +676,8 @@ public final class JSONResponseSerializer: ResponseSerializer {
     public init(dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor,
     public init(dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor,
                 emptyResponseCodes: Set<Int> = JSONResponseSerializer.defaultEmptyResponseCodes,
                 emptyResponseCodes: Set<Int> = JSONResponseSerializer.defaultEmptyResponseCodes,
                 emptyRequestMethods: Set<HTTPMethod> = JSONResponseSerializer.defaultEmptyRequestMethods,
                 emptyRequestMethods: Set<HTTPMethod> = JSONResponseSerializer.defaultEmptyRequestMethods,
-                options: JSONSerialization.ReadingOptions = .allowFragments) {
+                options: JSONSerialization.ReadingOptions = .allowFragments)
+    {
         self.dataPreprocessor = dataPreprocessor
         self.dataPreprocessor = dataPreprocessor
         self.emptyResponseCodes = emptyResponseCodes
         self.emptyResponseCodes = emptyResponseCodes
         self.emptyRequestMethods = emptyRequestMethods
         self.emptyRequestMethods = emptyRequestMethods
@@ -693,7 +705,7 @@ public final class JSONResponseSerializer: ResponseSerializer {
     }
     }
 }
 }
 
 
-extension DataRequest {
+public extension DataRequest {
     /// Adds a handler using a `JSONResponseSerializer` to be called once the request has finished.
     /// Adds a handler using a `JSONResponseSerializer` to be called once the request has finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -710,12 +722,13 @@ extension DataRequest {
     ///
     ///
     /// - Returns:               The request.
     /// - Returns:               The request.
     @discardableResult
     @discardableResult
-    public func responseJSON(queue: DispatchQueue = .main,
-                             dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor,
-                             emptyResponseCodes: Set<Int> = JSONResponseSerializer.defaultEmptyResponseCodes,
-                             emptyRequestMethods: Set<HTTPMethod> = JSONResponseSerializer.defaultEmptyRequestMethods,
-                             options: JSONSerialization.ReadingOptions = .allowFragments,
-                             completionHandler: @escaping (AFDataResponse<Any>) -> Void) -> Self {
+    func responseJSON(queue: DispatchQueue = .main,
+                      dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor,
+                      emptyResponseCodes: Set<Int> = JSONResponseSerializer.defaultEmptyResponseCodes,
+                      emptyRequestMethods: Set<HTTPMethod> = JSONResponseSerializer.defaultEmptyRequestMethods,
+                      options: JSONSerialization.ReadingOptions = .allowFragments,
+                      completionHandler: @escaping (AFDataResponse<Any>) -> Void) -> Self
+    {
         response(queue: queue,
         response(queue: queue,
                  responseSerializer: JSONResponseSerializer(dataPreprocessor: dataPreprocessor,
                  responseSerializer: JSONResponseSerializer(dataPreprocessor: dataPreprocessor,
                                                             emptyResponseCodes: emptyResponseCodes,
                                                             emptyResponseCodes: emptyResponseCodes,
@@ -725,7 +738,7 @@ extension DataRequest {
     }
     }
 }
 }
 
 
-extension DownloadRequest {
+public extension DownloadRequest {
     /// Adds a handler using a `JSONResponseSerializer` to be called once the request has finished.
     /// Adds a handler using a `JSONResponseSerializer` to be called once the request has finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -742,12 +755,13 @@ extension DownloadRequest {
     ///
     ///
     /// - Returns:               The request.
     /// - Returns:               The request.
     @discardableResult
     @discardableResult
-    public func responseJSON(queue: DispatchQueue = .main,
-                             dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor,
-                             emptyResponseCodes: Set<Int> = JSONResponseSerializer.defaultEmptyResponseCodes,
-                             emptyRequestMethods: Set<HTTPMethod> = JSONResponseSerializer.defaultEmptyRequestMethods,
-                             options: JSONSerialization.ReadingOptions = .allowFragments,
-                             completionHandler: @escaping (AFDownloadResponse<Any>) -> Void) -> Self {
+    func responseJSON(queue: DispatchQueue = .main,
+                      dataPreprocessor: DataPreprocessor = JSONResponseSerializer.defaultDataPreprocessor,
+                      emptyResponseCodes: Set<Int> = JSONResponseSerializer.defaultEmptyResponseCodes,
+                      emptyRequestMethods: Set<HTTPMethod> = JSONResponseSerializer.defaultEmptyRequestMethods,
+                      options: JSONSerialization.ReadingOptions = .allowFragments,
+                      completionHandler: @escaping (AFDownloadResponse<Any>) -> Void) -> Self
+    {
         response(queue: queue,
         response(queue: queue,
                  responseSerializer: JSONResponseSerializer(dataPreprocessor: dataPreprocessor,
                  responseSerializer: JSONResponseSerializer(dataPreprocessor: dataPreprocessor,
                                                             emptyResponseCodes: emptyResponseCodes,
                                                             emptyResponseCodes: emptyResponseCodes,
@@ -824,7 +838,8 @@ public final class DecodableResponseSerializer<T: Decodable>: ResponseSerializer
     public init(dataPreprocessor: DataPreprocessor = DecodableResponseSerializer.defaultDataPreprocessor,
     public init(dataPreprocessor: DataPreprocessor = DecodableResponseSerializer.defaultDataPreprocessor,
                 decoder: DataDecoder = JSONDecoder(),
                 decoder: DataDecoder = JSONDecoder(),
                 emptyResponseCodes: Set<Int> = DecodableResponseSerializer.defaultEmptyResponseCodes,
                 emptyResponseCodes: Set<Int> = DecodableResponseSerializer.defaultEmptyResponseCodes,
-                emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer.defaultEmptyRequestMethods) {
+                emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer.defaultEmptyRequestMethods)
+    {
         self.dataPreprocessor = dataPreprocessor
         self.dataPreprocessor = dataPreprocessor
         self.decoder = decoder
         self.decoder = decoder
         self.emptyResponseCodes = emptyResponseCodes
         self.emptyResponseCodes = emptyResponseCodes
@@ -856,7 +871,7 @@ public final class DecodableResponseSerializer<T: Decodable>: ResponseSerializer
     }
     }
 }
 }
 
 
-extension DataRequest {
+public extension DataRequest {
     /// Adds a handler using a `DecodableResponseSerializer` to be called once the request has finished.
     /// Adds a handler using a `DecodableResponseSerializer` to be called once the request has finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -875,13 +890,14 @@ extension DataRequest {
     ///
     ///
     /// - Returns:               The request.
     /// - Returns:               The request.
     @discardableResult
     @discardableResult
-    public func responseDecodable<T: Decodable>(of type: T.Type = T.self,
-                                                queue: DispatchQueue = .main,
-                                                dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,
-                                                decoder: DataDecoder = JSONDecoder(),
-                                                emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,
-                                                emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods,
-                                                completionHandler: @escaping (AFDataResponse<T>) -> Void) -> Self {
+    func responseDecodable<T: Decodable>(of _: T.Type = T.self,
+                                         queue: DispatchQueue = .main,
+                                         dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,
+                                         decoder: DataDecoder = JSONDecoder(),
+                                         emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,
+                                         emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods,
+                                         completionHandler: @escaping (AFDataResponse<T>) -> Void) -> Self
+    {
         response(queue: queue,
         response(queue: queue,
                  responseSerializer: DecodableResponseSerializer(dataPreprocessor: dataPreprocessor,
                  responseSerializer: DecodableResponseSerializer(dataPreprocessor: dataPreprocessor,
                                                                  decoder: decoder,
                                                                  decoder: decoder,
@@ -891,7 +907,7 @@ extension DataRequest {
     }
     }
 }
 }
 
 
-extension DownloadRequest {
+public extension DownloadRequest {
     /// Adds a handler using a `DecodableResponseSerializer` to be called once the request has finished.
     /// Adds a handler using a `DecodableResponseSerializer` to be called once the request has finished.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -910,13 +926,14 @@ extension DownloadRequest {
     ///
     ///
     /// - Returns:               The request.
     /// - Returns:               The request.
     @discardableResult
     @discardableResult
-    public func responseDecodable<T: Decodable>(of type: T.Type = T.self,
-                                                queue: DispatchQueue = .main,
-                                                dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,
-                                                decoder: DataDecoder = JSONDecoder(),
-                                                emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,
-                                                emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods,
-                                                completionHandler: @escaping (AFDownloadResponse<T>) -> Void) -> Self {
+    func responseDecodable<T: Decodable>(of _: T.Type = T.self,
+                                         queue: DispatchQueue = .main,
+                                         dataPreprocessor: DataPreprocessor = DecodableResponseSerializer<T>.defaultDataPreprocessor,
+                                         decoder: DataDecoder = JSONDecoder(),
+                                         emptyResponseCodes: Set<Int> = DecodableResponseSerializer<T>.defaultEmptyResponseCodes,
+                                         emptyRequestMethods: Set<HTTPMethod> = DecodableResponseSerializer<T>.defaultEmptyRequestMethods,
+                                         completionHandler: @escaping (AFDownloadResponse<T>) -> Void) -> Self
+    {
         response(queue: queue,
         response(queue: queue,
                  responseSerializer: DecodableResponseSerializer(dataPreprocessor: dataPreprocessor,
                  responseSerializer: DecodableResponseSerializer(dataPreprocessor: dataPreprocessor,
                                                                  decoder: decoder,
                                                                  decoder: decoder,
@@ -979,7 +996,7 @@ public struct StringStreamSerializer: DataStreamSerializer {
     }
     }
 }
 }
 
 
-extension DataStreamRequest {
+public extension DataStreamRequest {
     /// Adds a `StreamHandler` which performs no parsing on incoming `Data`.
     /// Adds a `StreamHandler` which performs no parsing on incoming `Data`.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -988,7 +1005,7 @@ extension DataStreamRequest {
     ///
     ///
     /// - Returns:  The `DataStreamRequest`.
     /// - Returns:  The `DataStreamRequest`.
     @discardableResult
     @discardableResult
-    public func responseStream(on queue: DispatchQueue = .main, stream: @escaping Handler<Data, Never>) -> Self {
+    func responseStream(on queue: DispatchQueue = .main, stream: @escaping Handler<Data, Never>) -> Self {
         let parser = { [unowned self] (data: Data) in
         let parser = { [unowned self] (data: Data) in
             queue.async {
             queue.async {
                 self.capturingError {
                 self.capturingError {
@@ -1014,9 +1031,10 @@ extension DataStreamRequest {
     ///
     ///
     /// - Returns:      The `DataStreamRequest`.
     /// - Returns:      The `DataStreamRequest`.
     @discardableResult
     @discardableResult
-    public func responseStream<Serializer: DataStreamSerializer>(using serializer: Serializer,
-                                                                 on queue: DispatchQueue = .main,
-                                                                 stream: @escaping Handler<Serializer.SerializedObject, AFError>) -> Self {
+    func responseStream<Serializer: DataStreamSerializer>(using serializer: Serializer,
+                                                          on queue: DispatchQueue = .main,
+                                                          stream: @escaping Handler<Serializer.SerializedObject, AFError>) -> Self
+    {
         let parser = { [unowned self] (data: Data) in
         let parser = { [unowned self] (data: Data) in
             self.serializationQueue.async {
             self.serializationQueue.async {
                 // Start work on serialization queue.
                 // Start work on serialization queue.
@@ -1055,8 +1073,9 @@ extension DataStreamRequest {
     ///
     ///
     /// - Returns:  The `DataStreamRequest`.
     /// - Returns:  The `DataStreamRequest`.
     @discardableResult
     @discardableResult
-    public func responseStreamString(on queue: DispatchQueue = .main,
-                                     stream: @escaping Handler<String, Never>) -> Self {
+    func responseStreamString(on queue: DispatchQueue = .main,
+                              stream: @escaping Handler<String, Never>) -> Self
+    {
         let parser = { [unowned self] (data: Data) in
         let parser = { [unowned self] (data: Data) in
             self.serializationQueue.async {
             self.serializationQueue.async {
                 // Start work on serialization queue.
                 // Start work on serialization queue.
@@ -1105,11 +1124,12 @@ extension DataStreamRequest {
     ///
     ///
     /// - Returns: The `DataStreamRequest`.
     /// - Returns: The `DataStreamRequest`.
     @discardableResult
     @discardableResult
-    public func responseStreamDecodable<T: Decodable>(of type: T.Type = T.self,
-                                                      on queue: DispatchQueue = .main,
-                                                      using decoder: DataDecoder = JSONDecoder(),
-                                                      preprocessor: DataPreprocessor = PassthroughPreprocessor(),
-                                                      stream: @escaping Handler<T, AFError>) -> Self {
+    func responseStreamDecodable<T: Decodable>(of _: T.Type = T.self,
+                                               on _: DispatchQueue = .main,
+                                               using decoder: DataDecoder = JSONDecoder(),
+                                               preprocessor: DataPreprocessor = PassthroughPreprocessor(),
+                                               stream: @escaping Handler<T, AFError>) -> Self
+    {
         responseStream(using: DecodableStreamSerializer<T>(decoder: decoder, dataPreprocessor: preprocessor),
         responseStream(using: DecodableStreamSerializer<T>(decoder: decoder, dataPreprocessor: preprocessor),
                        stream: stream)
                        stream: stream)
     }
     }

+ 11 - 8
Example/Pods/Alamofire/Source/RetryPolicy.swift

@@ -43,7 +43,7 @@ open class RetryPolicy: RequestInterceptor {
                                                                       .head, // [HEAD](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4) - generally idempotent
                                                                       .head, // [HEAD](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.4) - generally idempotent
                                                                       .options, // [OPTIONS](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2) - inherently idempotent
                                                                       .options, // [OPTIONS](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.2) - inherently idempotent
                                                                       .put, // [PUT](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6) - not always idempotent
                                                                       .put, // [PUT](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.6) - not always idempotent
-                                                                      .trace // [TRACE](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.8) - inherently idempotent
+                                                                      .trace, // [TRACE](https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.8) - inherently idempotent
     ]
     ]
 
 
     /// The default HTTP status codes to retry.
     /// The default HTTP status codes to retry.
@@ -52,11 +52,11 @@ open class RetryPolicy: RequestInterceptor {
                                                                    500, // [Internal Server Error](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1)
                                                                    500, // [Internal Server Error](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1)
                                                                    502, // [Bad Gateway](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.3)
                                                                    502, // [Bad Gateway](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.3)
                                                                    503, // [Service Unavailable](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4)
                                                                    503, // [Service Unavailable](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4)
-                                                                   504 // [Gateway Timeout](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.5)
+                                                                   504, // [Gateway Timeout](https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.5)
     ]
     ]
 
 
     /// The default URL error codes to retry.
     /// The default URL error codes to retry.
-    public static let defaultRetryableURLErrorCodes: Set<URLError.Code> = [// [Security] App Transport Security disallowed a connection because there is no secure network connection.
+    public static let defaultRetryableURLErrorCodes: Set<URLError.Code> = [ // [Security] App Transport Security disallowed a connection because there is no secure network connection.
         //   - [Disabled] ATS settings do not change at runtime.
         //   - [Disabled] ATS settings do not change at runtime.
         // .appTransportSecurityRequiresSecureConnection,
         // .appTransportSecurityRequiresSecureConnection,
 
 
@@ -235,7 +235,7 @@ open class RetryPolicy: RequestInterceptor {
 
 
         // [Network] An asynchronous operation timed out.
         // [Network] An asynchronous operation timed out.
         //   - [Enabled] The request timed out for an unknown reason and should be retried.
         //   - [Enabled] The request timed out for an unknown reason and should be retried.
-        .timedOut
+        .timedOut,
 
 
         // [System] The URL Loading System encountered an error that it can’t interpret.
         // [System] The URL Loading System encountered an error that it can’t interpret.
         //   - [Disabled] The error could not be interpreted and is unlikely to be recovered from during a retry.
         //   - [Disabled] The error could not be interpreted and is unlikely to be recovered from during a retry.
@@ -294,7 +294,8 @@ open class RetryPolicy: RequestInterceptor {
                 exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale,
                 exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale,
                 retryableHTTPMethods: Set<HTTPMethod> = RetryPolicy.defaultRetryableHTTPMethods,
                 retryableHTTPMethods: Set<HTTPMethod> = RetryPolicy.defaultRetryableHTTPMethods,
                 retryableHTTPStatusCodes: Set<Int> = RetryPolicy.defaultRetryableHTTPStatusCodes,
                 retryableHTTPStatusCodes: Set<Int> = RetryPolicy.defaultRetryableHTTPStatusCodes,
-                retryableURLErrorCodes: Set<URLError.Code> = RetryPolicy.defaultRetryableURLErrorCodes) {
+                retryableURLErrorCodes: Set<URLError.Code> = RetryPolicy.defaultRetryableURLErrorCodes)
+    {
         precondition(exponentialBackoffBase >= 2, "The `exponentialBackoffBase` must be a minimum of 2.")
         precondition(exponentialBackoffBase >= 2, "The `exponentialBackoffBase` must be a minimum of 2.")
 
 
         self.retryLimit = retryLimit
         self.retryLimit = retryLimit
@@ -306,9 +307,10 @@ open class RetryPolicy: RequestInterceptor {
     }
     }
 
 
     open func retry(_ request: Request,
     open func retry(_ request: Request,
-                    for session: Session,
+                    for _: Session,
                     dueTo error: Error,
                     dueTo error: Error,
-                    completion: @escaping (RetryResult) -> Void) {
+                    completion: @escaping (RetryResult) -> Void)
+    {
         if request.retryCount < retryLimit, shouldRetry(request: request, dueTo: error) {
         if request.retryCount < retryLimit, shouldRetry(request: request, dueTo: error) {
             completion(.retryWithDelay(pow(Double(exponentialBackoffBase), Double(request.retryCount)) * exponentialBackoffScale))
             completion(.retryWithDelay(pow(Double(exponentialBackoffBase), Double(request.retryCount)) * exponentialBackoffScale))
         } else {
         } else {
@@ -359,7 +361,8 @@ open class ConnectionLostRetryPolicy: RetryPolicy {
     public init(retryLimit: UInt = RetryPolicy.defaultRetryLimit,
     public init(retryLimit: UInt = RetryPolicy.defaultRetryLimit,
                 exponentialBackoffBase: UInt = RetryPolicy.defaultExponentialBackoffBase,
                 exponentialBackoffBase: UInt = RetryPolicy.defaultExponentialBackoffBase,
                 exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale,
                 exponentialBackoffScale: Double = RetryPolicy.defaultExponentialBackoffScale,
-                retryableHTTPMethods: Set<HTTPMethod> = RetryPolicy.defaultRetryableHTTPMethods) {
+                retryableHTTPMethods: Set<HTTPMethod> = RetryPolicy.defaultRetryableHTTPMethods)
+    {
         super.init(retryLimit: retryLimit,
         super.init(retryLimit: retryLimit,
                    exponentialBackoffBase: exponentialBackoffBase,
                    exponentialBackoffBase: exponentialBackoffBase,
                    exponentialBackoffScale: exponentialBackoffScale,
                    exponentialBackoffScale: exponentialBackoffScale,

+ 467 - 465
Example/Pods/Alamofire/Source/ServerTrustEvaluation.swift

@@ -49,27 +49,27 @@ open class ServerTrustManager {
     }
     }
 
 
     #if !(os(Linux) || os(Windows))
     #if !(os(Linux) || os(Windows))
-    /// Returns the `ServerTrustEvaluating` value for the given host, if one is set.
-    ///
-    /// By default, this method will return the policy that perfectly matches the given host. Subclasses could override
-    /// this method and implement more complex mapping implementations such as wildcards.
-    ///
-    /// - Parameter host: The host to use when searching for a matching policy.
-    ///
-    /// - Returns:        The `ServerTrustEvaluating` value for the given host if found, `nil` otherwise.
-    /// - Throws:         `AFError.serverTrustEvaluationFailed` if `allHostsMustBeEvaluated` is `true` and no matching
-    ///                   evaluators are found.
-    open func serverTrustEvaluator(forHost host: String) throws -> ServerTrustEvaluating? {
-        guard let evaluator = evaluators[host] else {
-            if allHostsMustBeEvaluated {
-                throw AFError.serverTrustEvaluationFailed(reason: .noRequiredEvaluator(host: host))
+        /// Returns the `ServerTrustEvaluating` value for the given host, if one is set.
+        ///
+        /// By default, this method will return the policy that perfectly matches the given host. Subclasses could override
+        /// this method and implement more complex mapping implementations such as wildcards.
+        ///
+        /// - Parameter host: The host to use when searching for a matching policy.
+        ///
+        /// - Returns:        The `ServerTrustEvaluating` value for the given host if found, `nil` otherwise.
+        /// - Throws:         `AFError.serverTrustEvaluationFailed` if `allHostsMustBeEvaluated` is `true` and no matching
+        ///                   evaluators are found.
+        open func serverTrustEvaluator(forHost host: String) throws -> ServerTrustEvaluating? {
+            guard let evaluator = evaluators[host] else {
+                if allHostsMustBeEvaluated {
+                    throw AFError.serverTrustEvaluationFailed(reason: .noRequiredEvaluator(host: host))
+                }
+
+                return nil
             }
             }
 
 
-            return nil
+            return evaluator
         }
         }
-
-        return evaluator
-    }
     #endif
     #endif
 }
 }
 
 
@@ -78,546 +78,548 @@ public protocol ServerTrustEvaluating {
     #if os(Linux) || os(Windows)
     #if os(Linux) || os(Windows)
     // Implement this once Linux/Windows has API for evaluating server trusts.
     // Implement this once Linux/Windows has API for evaluating server trusts.
     #else
     #else
-    /// Evaluates the given `SecTrust` value for the given `host`.
-    ///
-    /// - Parameters:
-    ///   - trust: The `SecTrust` value to evaluate.
-    ///   - host:  The host for which to evaluate the `SecTrust` value.
-    ///
-    /// - Returns: A `Bool` indicating whether the evaluator considers the `SecTrust` value valid for `host`.
-    func evaluate(_ trust: SecTrust, forHost host: String) throws
+        /// Evaluates the given `SecTrust` value for the given `host`.
+        ///
+        /// - Parameters:
+        ///   - trust: The `SecTrust` value to evaluate.
+        ///   - host:  The host for which to evaluate the `SecTrust` value.
+        ///
+        /// - Returns: A `Bool` indicating whether the evaluator considers the `SecTrust` value valid for `host`.
+        func evaluate(_ trust: SecTrust, forHost host: String) throws
     #endif
     #endif
 }
 }
 
 
 // MARK: - Server Trust Evaluators
 // MARK: - Server Trust Evaluators
 
 
 #if !(os(Linux) || os(Windows))
 #if !(os(Linux) || os(Windows))
-/// An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the
-/// host provided by the challenge. Applications are encouraged to always validate the host in production environments
-/// to guarantee the validity of the server's certificate chain.
-public final class DefaultTrustEvaluator: ServerTrustEvaluating {
-    private let validateHost: Bool
+    /// An evaluator which uses the default server trust evaluation while allowing you to control whether to validate the
+    /// host provided by the challenge. Applications are encouraged to always validate the host in production environments
+    /// to guarantee the validity of the server's certificate chain.
+    public final class DefaultTrustEvaluator: ServerTrustEvaluating {
+        private let validateHost: Bool
 
 
-    /// Creates a `DefaultTrustEvaluator`.
-    ///
-    /// - Parameter validateHost: Determines whether or not the evaluator should validate the host. `true` by default.
-    public init(validateHost: Bool = true) {
-        self.validateHost = validateHost
-    }
-
-    public func evaluate(_ trust: SecTrust, forHost host: String) throws {
-        if validateHost {
-            try trust.af.performValidation(forHost: host)
+        /// Creates a `DefaultTrustEvaluator`.
+        ///
+        /// - Parameter validateHost: Determines whether or not the evaluator should validate the host. `true` by default.
+        public init(validateHost: Bool = true) {
+            self.validateHost = validateHost
         }
         }
 
 
-        try trust.af.performDefaultValidation(forHost: host)
-    }
-}
+        public func evaluate(_ trust: SecTrust, forHost host: String) throws {
+            if validateHost {
+                try trust.af.performValidation(forHost: host)
+            }
 
 
-/// An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate
-/// the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates.
-/// Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS
-/// 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production
-/// environments to guarantee the validity of the server's certificate chain.
-public final class RevocationTrustEvaluator: ServerTrustEvaluating {
-    /// Represents the options to be use when evaluating the status of a certificate.
-    /// 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).
-    public struct Options: OptionSet {
-        /// Perform revocation checking using the CRL (Certification Revocation List) method.
-        public static let crl = Options(rawValue: kSecRevocationCRLMethod)
-        /// Consult only locally cached replies; do not use network access.
-        public static let networkAccessDisabled = Options(rawValue: kSecRevocationNetworkAccessDisabled)
-        /// Perform revocation checking using OCSP (Online Certificate Status Protocol).
-        public static let ocsp = Options(rawValue: kSecRevocationOCSPMethod)
-        /// Prefer CRL revocation checking over OCSP; by default, OCSP is preferred.
-        public static let preferCRL = Options(rawValue: kSecRevocationPreferCRL)
-        /// Require a positive response to pass the policy. If the flag is not set, revocation checking is done on a
-        /// "best attempt" basis, where failure to reach the server is not considered fatal.
-        public static let requirePositiveResponse = Options(rawValue: kSecRevocationRequirePositiveResponse)
-        /// Perform either OCSP or CRL checking. The checking is performed according to the method(s) specified in the
-        /// certificate and the value of `preferCRL`.
-        public static let any = Options(rawValue: kSecRevocationUseAnyAvailableMethod)
-
-        /// The raw value of the option.
-        public let rawValue: CFOptionFlags
-
-        /// Creates an `Options` value with the given `CFOptionFlags`.
-        ///
-        /// - Parameter rawValue: The `CFOptionFlags` value to initialize with.
-        public init(rawValue: CFOptionFlags) {
-            self.rawValue = rawValue
+            try trust.af.performDefaultValidation(forHost: host)
         }
         }
     }
     }
 
 
-    private let performDefaultValidation: Bool
-    private let validateHost: Bool
-    private let options: Options
+    /// An evaluator which Uses the default and revoked server trust evaluations allowing you to control whether to validate
+    /// the host provided by the challenge as well as specify the revocation flags for testing for revoked certificates.
+    /// Apple platforms did not start testing for revoked certificates automatically until iOS 10.1, macOS 10.12 and tvOS
+    /// 10.1 which is demonstrated in our TLS tests. Applications are encouraged to always validate the host in production
+    /// environments to guarantee the validity of the server's certificate chain.
+    public final class RevocationTrustEvaluator: ServerTrustEvaluating {
+        /// Represents the options to be use when evaluating the status of a certificate.
+        /// 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).
+        public struct Options: OptionSet {
+            /// Perform revocation checking using the CRL (Certification Revocation List) method.
+            public static let crl = Options(rawValue: kSecRevocationCRLMethod)
+            /// Consult only locally cached replies; do not use network access.
+            public static let networkAccessDisabled = Options(rawValue: kSecRevocationNetworkAccessDisabled)
+            /// Perform revocation checking using OCSP (Online Certificate Status Protocol).
+            public static let ocsp = Options(rawValue: kSecRevocationOCSPMethod)
+            /// Prefer CRL revocation checking over OCSP; by default, OCSP is preferred.
+            public static let preferCRL = Options(rawValue: kSecRevocationPreferCRL)
+            /// Require a positive response to pass the policy. If the flag is not set, revocation checking is done on a
+            /// "best attempt" basis, where failure to reach the server is not considered fatal.
+            public static let requirePositiveResponse = Options(rawValue: kSecRevocationRequirePositiveResponse)
+            /// Perform either OCSP or CRL checking. The checking is performed according to the method(s) specified in the
+            /// certificate and the value of `preferCRL`.
+            public static let any = Options(rawValue: kSecRevocationUseAnyAvailableMethod)
+
+            /// The raw value of the option.
+            public let rawValue: CFOptionFlags
+
+            /// Creates an `Options` value with the given `CFOptionFlags`.
+            ///
+            /// - Parameter rawValue: The `CFOptionFlags` value to initialize with.
+            public init(rawValue: CFOptionFlags) {
+                self.rawValue = rawValue
+            }
+        }
 
 
-    /// Creates a `RevocationTrustEvaluator`.
-    ///
-    /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use
-    ///         `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.
-    ///
-    /// - Parameters:
-    ///   - performDefaultValidation:     Determines whether default validation should be performed in addition to
-    ///                                   evaluating the pinned certificates. `true` by default.
-    ///   - validateHost:                 Determines whether or not the evaluator should validate the host, in addition
-    ///                                   to performing the default evaluation, even if `performDefaultValidation` is
-    ///                                   `false`. `true` by default.
-    ///   - options:                      The `Options` to use to check the revocation status of the certificate. `.any`
-    ///                                   by default.
-    public init(performDefaultValidation: Bool = true, validateHost: Bool = true, options: Options = .any) {
-        self.performDefaultValidation = performDefaultValidation
-        self.validateHost = validateHost
-        self.options = options
-    }
+        private let performDefaultValidation: Bool
+        private let validateHost: Bool
+        private let options: Options
 
 
-    public func evaluate(_ trust: SecTrust, forHost host: String) throws {
-        if performDefaultValidation {
-            try trust.af.performDefaultValidation(forHost: host)
+        /// Creates a `RevocationTrustEvaluator`.
+        ///
+        /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use
+        ///         `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.
+        ///
+        /// - Parameters:
+        ///   - performDefaultValidation:     Determines whether default validation should be performed in addition to
+        ///                                   evaluating the pinned certificates. `true` by default.
+        ///   - validateHost:                 Determines whether or not the evaluator should validate the host, in addition
+        ///                                   to performing the default evaluation, even if `performDefaultValidation` is
+        ///                                   `false`. `true` by default.
+        ///   - options:                      The `Options` to use to check the revocation status of the certificate. `.any`
+        ///                                   by default.
+        public init(performDefaultValidation: Bool = true, validateHost: Bool = true, options: Options = .any) {
+            self.performDefaultValidation = performDefaultValidation
+            self.validateHost = validateHost
+            self.options = options
         }
         }
 
 
-        if validateHost {
-            try trust.af.performValidation(forHost: host)
-        }
+        public func evaluate(_ trust: SecTrust, forHost host: String) throws {
+            if performDefaultValidation {
+                try trust.af.performDefaultValidation(forHost: host)
+            }
 
 
-        if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {
-            try trust.af.evaluate(afterApplying: SecPolicy.af.revocation(options: options))
-        } else {
-            try trust.af.validate(policy: SecPolicy.af.revocation(options: options)) { status, result in
-                AFError.serverTrustEvaluationFailed(reason: .revocationCheckFailed(output: .init(host, trust, status, result), options: options))
+            if validateHost {
+                try trust.af.performValidation(forHost: host)
+            }
+
+            if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {
+                try trust.af.evaluate(afterApplying: SecPolicy.af.revocation(options: options))
+            } else {
+                try trust.af.validate(policy: SecPolicy.af.revocation(options: options)) { status, result in
+                    AFError.serverTrustEvaluationFailed(reason: .revocationCheckFailed(output: .init(host, trust, status, result), options: options))
+                }
             }
             }
         }
         }
     }
     }
-}
 
 
-/// Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned
-/// certificates match one of the server certificates. By validating both the certificate chain and host, certificate
-/// pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks.
-/// Applications are encouraged to always validate the host and require a valid certificate chain in production
-/// environments.
-public final class PinnedCertificatesTrustEvaluator: ServerTrustEvaluating {
-    private let certificates: [SecCertificate]
-    private let acceptSelfSignedCertificates: Bool
-    private let performDefaultValidation: Bool
-    private let validateHost: Bool
-
-    /// Creates a `PinnedCertificatesTrustEvaluator`.
-    ///
-    /// - Parameters:
-    ///   - certificates:                 The certificates to use to evaluate the trust. All `cer`, `crt`, and `der`
-    ///                                   certificates in `Bundle.main` by default.
-    ///   - acceptSelfSignedCertificates: Adds the provided certificates as anchors for the trust evaluation, allowing
-    ///                                   self-signed certificates to pass. `false` by default. THIS SETTING SHOULD BE
-    ///                                   FALSE IN PRODUCTION!
-    ///   - performDefaultValidation:     Determines whether default validation should be performed in addition to
-    ///                                   evaluating the pinned certificates. `true` by default.
-    ///   - validateHost:                 Determines whether or not the evaluator should validate the host, in addition
-    ///                                   to performing the default evaluation, even if `performDefaultValidation` is
-    ///                                   `false`. `true` by default.
-    public init(certificates: [SecCertificate] = Bundle.main.af.certificates,
-                acceptSelfSignedCertificates: Bool = false,
-                performDefaultValidation: Bool = true,
-                validateHost: Bool = true) {
-        self.certificates = certificates
-        self.acceptSelfSignedCertificates = acceptSelfSignedCertificates
-        self.performDefaultValidation = performDefaultValidation
-        self.validateHost = validateHost
-    }
+    /// Uses the pinned certificates to validate the server trust. The server trust is considered valid if one of the pinned
+    /// certificates match one of the server certificates. By validating both the certificate chain and host, certificate
+    /// pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks.
+    /// Applications are encouraged to always validate the host and require a valid certificate chain in production
+    /// environments.
+    public final class PinnedCertificatesTrustEvaluator: ServerTrustEvaluating {
+        private let certificates: [SecCertificate]
+        private let acceptSelfSignedCertificates: Bool
+        private let performDefaultValidation: Bool
+        private let validateHost: Bool
 
 
-    public func evaluate(_ trust: SecTrust, forHost host: String) throws {
-        guard !certificates.isEmpty else {
-            throw AFError.serverTrustEvaluationFailed(reason: .noCertificatesFound)
+        /// Creates a `PinnedCertificatesTrustEvaluator`.
+        ///
+        /// - Parameters:
+        ///   - certificates:                 The certificates to use to evaluate the trust. All `cer`, `crt`, and `der`
+        ///                                   certificates in `Bundle.main` by default.
+        ///   - acceptSelfSignedCertificates: Adds the provided certificates as anchors for the trust evaluation, allowing
+        ///                                   self-signed certificates to pass. `false` by default. THIS SETTING SHOULD BE
+        ///                                   FALSE IN PRODUCTION!
+        ///   - performDefaultValidation:     Determines whether default validation should be performed in addition to
+        ///                                   evaluating the pinned certificates. `true` by default.
+        ///   - validateHost:                 Determines whether or not the evaluator should validate the host, in addition
+        ///                                   to performing the default evaluation, even if `performDefaultValidation` is
+        ///                                   `false`. `true` by default.
+        public init(certificates: [SecCertificate] = Bundle.main.af.certificates,
+                    acceptSelfSignedCertificates: Bool = false,
+                    performDefaultValidation: Bool = true,
+                    validateHost: Bool = true)
+        {
+            self.certificates = certificates
+            self.acceptSelfSignedCertificates = acceptSelfSignedCertificates
+            self.performDefaultValidation = performDefaultValidation
+            self.validateHost = validateHost
         }
         }
 
 
-        if acceptSelfSignedCertificates {
-            try trust.af.setAnchorCertificates(certificates)
-        }
+        public func evaluate(_ trust: SecTrust, forHost host: String) throws {
+            guard !certificates.isEmpty else {
+                throw AFError.serverTrustEvaluationFailed(reason: .noCertificatesFound)
+            }
 
 
-        if performDefaultValidation {
-            try trust.af.performDefaultValidation(forHost: host)
-        }
+            if acceptSelfSignedCertificates {
+                try trust.af.setAnchorCertificates(certificates)
+            }
 
 
-        if validateHost {
-            try trust.af.performValidation(forHost: host)
-        }
+            if performDefaultValidation {
+                try trust.af.performDefaultValidation(forHost: host)
+            }
+
+            if validateHost {
+                try trust.af.performValidation(forHost: host)
+            }
 
 
-        let serverCertificatesData = Set(trust.af.certificateData)
-        let pinnedCertificatesData = Set(certificates.af.data)
-        let pinnedCertificatesInServerData = !serverCertificatesData.isDisjoint(with: pinnedCertificatesData)
-        if !pinnedCertificatesInServerData {
-            throw AFError.serverTrustEvaluationFailed(reason: .certificatePinningFailed(host: host,
-                                                                                        trust: trust,
-                                                                                        pinnedCertificates: certificates,
-                                                                                        serverCertificates: trust.af.certificates))
+            let serverCertificatesData = Set(trust.af.certificateData)
+            let pinnedCertificatesData = Set(certificates.af.data)
+            let pinnedCertificatesInServerData = !serverCertificatesData.isDisjoint(with: pinnedCertificatesData)
+            if !pinnedCertificatesInServerData {
+                throw AFError.serverTrustEvaluationFailed(reason: .certificatePinningFailed(host: host,
+                                                                                            trust: trust,
+                                                                                            pinnedCertificates: certificates,
+                                                                                            serverCertificates: trust.af.certificates))
+            }
         }
         }
     }
     }
-}
 
 
-/// Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned
-/// public keys match one of the server certificate public keys. By validating both the certificate chain and host,
-/// public key pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks.
-/// Applications are encouraged to always validate the host and require a valid certificate chain in production
-/// environments.
-public final class PublicKeysTrustEvaluator: ServerTrustEvaluating {
-    private let keys: [SecKey]
-    private let performDefaultValidation: Bool
-    private let validateHost: Bool
-
-    /// Creates a `PublicKeysTrustEvaluator`.
-    ///
-    /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use
-    ///         `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.
-    ///
-    /// - Parameters:
-    ///   - keys:                     The `SecKey`s to use to validate public keys. Defaults to the public keys of all
-    ///                               certificates included in the main bundle.
-    ///   - performDefaultValidation: Determines whether default validation should be performed in addition to
-    ///                               evaluating the pinned certificates. `true` by default.
-    ///   - validateHost:             Determines whether or not the evaluator should validate the host, in addition to
-    ///                               performing the default evaluation, even if `performDefaultValidation` is `false`.
-    ///                               `true` by default.
-    public init(keys: [SecKey] = Bundle.main.af.publicKeys,
-                performDefaultValidation: Bool = true,
-                validateHost: Bool = true) {
-        self.keys = keys
-        self.performDefaultValidation = performDefaultValidation
-        self.validateHost = validateHost
-    }
+    /// Uses the pinned public keys to validate the server trust. The server trust is considered valid if one of the pinned
+    /// public keys match one of the server certificate public keys. By validating both the certificate chain and host,
+    /// public key pinning provides a very secure form of server trust validation mitigating most, if not all, MITM attacks.
+    /// Applications are encouraged to always validate the host and require a valid certificate chain in production
+    /// environments.
+    public final class PublicKeysTrustEvaluator: ServerTrustEvaluating {
+        private let keys: [SecKey]
+        private let performDefaultValidation: Bool
+        private let validateHost: Bool
 
 
-    public func evaluate(_ trust: SecTrust, forHost host: String) throws {
-        guard !keys.isEmpty else {
-            throw AFError.serverTrustEvaluationFailed(reason: .noPublicKeysFound)
+        /// Creates a `PublicKeysTrustEvaluator`.
+        ///
+        /// - Note: Default and host validation will fail when using this evaluator with self-signed certificates. Use
+        ///         `PinnedCertificatesTrustEvaluator` if you need to use self-signed certificates.
+        ///
+        /// - Parameters:
+        ///   - keys:                     The `SecKey`s to use to validate public keys. Defaults to the public keys of all
+        ///                               certificates included in the main bundle.
+        ///   - performDefaultValidation: Determines whether default validation should be performed in addition to
+        ///                               evaluating the pinned certificates. `true` by default.
+        ///   - validateHost:             Determines whether or not the evaluator should validate the host, in addition to
+        ///                               performing the default evaluation, even if `performDefaultValidation` is `false`.
+        ///                               `true` by default.
+        public init(keys: [SecKey] = Bundle.main.af.publicKeys,
+                    performDefaultValidation: Bool = true,
+                    validateHost: Bool = true)
+        {
+            self.keys = keys
+            self.performDefaultValidation = performDefaultValidation
+            self.validateHost = validateHost
         }
         }
 
 
-        if performDefaultValidation {
-            try trust.af.performDefaultValidation(forHost: host)
-        }
+        public func evaluate(_ trust: SecTrust, forHost host: String) throws {
+            guard !keys.isEmpty else {
+                throw AFError.serverTrustEvaluationFailed(reason: .noPublicKeysFound)
+            }
 
 
-        if validateHost {
-            try trust.af.performValidation(forHost: host)
-        }
+            if performDefaultValidation {
+                try trust.af.performDefaultValidation(forHost: host)
+            }
+
+            if validateHost {
+                try trust.af.performValidation(forHost: host)
+            }
 
 
-        let pinnedKeysInServerKeys: Bool = {
-            for serverPublicKey in trust.af.publicKeys {
-                for pinnedPublicKey in keys {
-                    if serverPublicKey == pinnedPublicKey {
-                        return true
+            let pinnedKeysInServerKeys: Bool = {
+                for serverPublicKey in trust.af.publicKeys {
+                    for pinnedPublicKey in keys {
+                        if serverPublicKey == pinnedPublicKey {
+                            return true
+                        }
                     }
                     }
                 }
                 }
+                return false
+            }()
+
+            if !pinnedKeysInServerKeys {
+                throw AFError.serverTrustEvaluationFailed(reason: .publicKeyPinningFailed(host: host,
+                                                                                          trust: trust,
+                                                                                          pinnedKeys: keys,
+                                                                                          serverKeys: trust.af.publicKeys))
             }
             }
-            return false
-        }()
-
-        if !pinnedKeysInServerKeys {
-            throw AFError.serverTrustEvaluationFailed(reason: .publicKeyPinningFailed(host: host,
-                                                                                      trust: trust,
-                                                                                      pinnedKeys: keys,
-                                                                                      serverKeys: trust.af.publicKeys))
         }
         }
     }
     }
-}
 
 
-/// Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the
-/// evaluators consider it valid.
-public final class CompositeTrustEvaluator: ServerTrustEvaluating {
-    private let evaluators: [ServerTrustEvaluating]
+    /// Uses the provided evaluators to validate the server trust. The trust is only considered valid if all of the
+    /// evaluators consider it valid.
+    public final class CompositeTrustEvaluator: ServerTrustEvaluating {
+        private let evaluators: [ServerTrustEvaluating]
 
 
-    /// Creates a `CompositeTrustEvaluator`.
-    ///
-    /// - Parameter evaluators: The `ServerTrustEvaluating` values used to evaluate the server trust.
-    public init(evaluators: [ServerTrustEvaluating]) {
-        self.evaluators = evaluators
-    }
+        /// Creates a `CompositeTrustEvaluator`.
+        ///
+        /// - Parameter evaluators: The `ServerTrustEvaluating` values used to evaluate the server trust.
+        public init(evaluators: [ServerTrustEvaluating]) {
+            self.evaluators = evaluators
+        }
 
 
-    public func evaluate(_ trust: SecTrust, forHost host: String) throws {
-        try evaluators.evaluate(trust, forHost: host)
+        public func evaluate(_ trust: SecTrust, forHost host: String) throws {
+            try evaluators.evaluate(trust, forHost: host)
+        }
     }
     }
-}
-
-/// Disables all evaluation which in turn will always consider any server trust as valid.
-///
-/// - Note: Instead of disabling server trust evaluation, it's a better idea to configure systems to properly trust test
-///         certificates, as outlined in [this Apple tech note](https://developer.apple.com/library/archive/qa/qa1948/_index.html).
-///
-/// **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**
-@available(*, deprecated, renamed: "DisabledTrustEvaluator", message: "DisabledEvaluator has been renamed DisabledTrustEvaluator.")
-public typealias DisabledEvaluator = DisabledTrustEvaluator
-
-/// Disables all evaluation which in turn will always consider any server trust as valid.
-///
-///
-/// - Note: Instead of disabling server trust evaluation, it's a better idea to configure systems to properly trust test
-///         certificates, as outlined in [this Apple tech note](https://developer.apple.com/library/archive/qa/qa1948/_index.html).
-///
-/// **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**
-public final class DisabledTrustEvaluator: ServerTrustEvaluating {
-    /// Creates an instance.
-    public init() {}
-
-    public func evaluate(_ trust: SecTrust, forHost host: String) throws {}
-}
 
 
-// MARK: - Extensions
+    /// Disables all evaluation which in turn will always consider any server trust as valid.
+    ///
+    /// - Note: Instead of disabling server trust evaluation, it's a better idea to configure systems to properly trust test
+    ///         certificates, as outlined in [this Apple tech note](https://developer.apple.com/library/archive/qa/qa1948/_index.html).
+    ///
+    /// **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**
+    @available(*, deprecated, renamed: "DisabledTrustEvaluator", message: "DisabledEvaluator has been renamed DisabledTrustEvaluator.")
+    public typealias DisabledEvaluator = DisabledTrustEvaluator
 
 
-extension Array where Element == ServerTrustEvaluating {
-    #if os(Linux) || os(Windows)
-    // Add this same convenience method for Linux/Windows.
-    #else
-    /// Evaluates the given `SecTrust` value for the given `host`.
+    /// Disables all evaluation which in turn will always consider any server trust as valid.
     ///
     ///
-    /// - Parameters:
-    ///   - trust: The `SecTrust` value to evaluate.
-    ///   - host:  The host for which to evaluate the `SecTrust` value.
     ///
     ///
-    /// - Returns: Whether or not the evaluator considers the `SecTrust` value valid for `host`.
-    public func evaluate(_ trust: SecTrust, forHost host: String) throws {
-        for evaluator in self {
-            try evaluator.evaluate(trust, forHost: host)
-        }
+    /// - Note: Instead of disabling server trust evaluation, it's a better idea to configure systems to properly trust test
+    ///         certificates, as outlined in [this Apple tech note](https://developer.apple.com/library/archive/qa/qa1948/_index.html).
+    ///
+    /// **THIS EVALUATOR SHOULD NEVER BE USED IN PRODUCTION!**
+    public final class DisabledTrustEvaluator: ServerTrustEvaluating {
+        /// Creates an instance.
+        public init() {}
+
+        public func evaluate(_: SecTrust, forHost _: String) throws {}
     }
     }
-    #endif
-}
 
 
-extension Bundle: AlamofireExtended {}
-extension AlamofireExtension where ExtendedType: Bundle {
-    /// Returns all valid `cer`, `crt`, and `der` certificates in the bundle.
-    public var certificates: [SecCertificate] {
-        paths(forResourcesOfTypes: [".cer", ".CER", ".crt", ".CRT", ".der", ".DER"]).compactMap { path in
-            guard
-                let certificateData = try? Data(contentsOf: URL(fileURLWithPath: path)) as CFData,
-                let certificate = SecCertificateCreateWithData(nil, certificateData) else { return nil }
+    // MARK: - Extensions
 
 
-            return certificate
-        }
+    public extension Array where Element == ServerTrustEvaluating {
+        #if os(Linux) || os(Windows)
+        // Add this same convenience method for Linux/Windows.
+        #else
+            /// Evaluates the given `SecTrust` value for the given `host`.
+            ///
+            /// - Parameters:
+            ///   - trust: The `SecTrust` value to evaluate.
+            ///   - host:  The host for which to evaluate the `SecTrust` value.
+            ///
+            /// - Returns: Whether or not the evaluator considers the `SecTrust` value valid for `host`.
+            func evaluate(_ trust: SecTrust, forHost host: String) throws {
+                for evaluator in self {
+                    try evaluator.evaluate(trust, forHost: host)
+                }
+            }
+        #endif
     }
     }
 
 
-    /// Returns all public keys for the valid certificates in the bundle.
-    public var publicKeys: [SecKey] {
-        certificates.af.publicKeys
-    }
+    extension Bundle: AlamofireExtended {}
+    public extension AlamofireExtension where ExtendedType: Bundle {
+        /// Returns all valid `cer`, `crt`, and `der` certificates in the bundle.
+        var certificates: [SecCertificate] {
+            paths(forResourcesOfTypes: [".cer", ".CER", ".crt", ".CRT", ".der", ".DER"]).compactMap { path in
+                guard
+                    let certificateData = try? Data(contentsOf: URL(fileURLWithPath: path)) as CFData,
+                    let certificate = SecCertificateCreateWithData(nil, certificateData) else { return nil }
 
 
-    /// Returns all pathnames for the resources identified by the provided file extensions.
-    ///
-    /// - Parameter types: The filename extensions locate.
-    ///
-    /// - Returns:         All pathnames for the given filename extensions.
-    public func paths(forResourcesOfTypes types: [String]) -> [String] {
-        Array(Set(types.flatMap { type.paths(forResourcesOfType: $0, inDirectory: nil) }))
-    }
-}
+                return certificate
+            }
+        }
 
 
-extension SecTrust: AlamofireExtended {}
-extension AlamofireExtension where ExtendedType == SecTrust {
-    /// Evaluates `self` after applying the `SecPolicy` value provided.
-    ///
-    /// - Parameter policy: The `SecPolicy` to apply to `self` before evaluation.
-    ///
-    /// - Throws:           Any `Error` from applying the `SecPolicy` or from evaluation.
-    @available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)
-    public func evaluate(afterApplying policy: SecPolicy) throws {
-        try apply(policy: policy).af.evaluate()
-    }
+        /// Returns all public keys for the valid certificates in the bundle.
+        var publicKeys: [SecKey] {
+            certificates.af.publicKeys
+        }
 
 
-    /// Attempts to validate `self` using the `SecPolicy` provided and transforming any error produced using the closure passed.
-    ///
-    /// - Parameters:
-    ///   - policy:        The `SecPolicy` used to evaluate `self`.
-    ///   - errorProducer: The closure used transform the failed `OSStatus` and `SecTrustResultType`.
-    /// - Throws:          Any `Error` from applying the `policy`, or the result of `errorProducer` if validation fails.
-    @available(iOS, introduced: 10, deprecated: 12, renamed: "evaluate(afterApplying:)")
-    @available(macOS, introduced: 10.12, deprecated: 10.14, renamed: "evaluate(afterApplying:)")
-    @available(tvOS, introduced: 10, deprecated: 12, renamed: "evaluate(afterApplying:)")
-    @available(watchOS, introduced: 3, deprecated: 5, renamed: "evaluate(afterApplying:)")
-    public func validate(policy: SecPolicy, errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws {
-        try apply(policy: policy).af.validate(errorProducer: errorProducer)
+        /// Returns all pathnames for the resources identified by the provided file extensions.
+        ///
+        /// - Parameter types: The filename extensions locate.
+        ///
+        /// - Returns:         All pathnames for the given filename extensions.
+        func paths(forResourcesOfTypes types: [String]) -> [String] {
+            Array(Set(types.flatMap { type.paths(forResourcesOfType: $0, inDirectory: nil) }))
+        }
     }
     }
 
 
-    /// Applies a `SecPolicy` to `self`, throwing if it fails.
-    ///
-    /// - Parameter policy: The `SecPolicy`.
-    ///
-    /// - Returns: `self`, with the policy applied.
-    /// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.policyApplicationFailed` reason.
-    public func apply(policy: SecPolicy) throws -> SecTrust {
-        let status = SecTrustSetPolicies(type, policy)
+    extension SecTrust: AlamofireExtended {}
+    public extension AlamofireExtension where ExtendedType == SecTrust {
+        /// Evaluates `self` after applying the `SecPolicy` value provided.
+        ///
+        /// - Parameter policy: The `SecPolicy` to apply to `self` before evaluation.
+        ///
+        /// - Throws:           Any `Error` from applying the `SecPolicy` or from evaluation.
+        @available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)
+        func evaluate(afterApplying policy: SecPolicy) throws {
+            try apply(policy: policy).af.evaluate()
+        }
 
 
-        guard status.af.isSuccess else {
-            throw AFError.serverTrustEvaluationFailed(reason: .policyApplicationFailed(trust: type,
-                                                                                       policy: policy,
-                                                                                       status: status))
+        /// Attempts to validate `self` using the `SecPolicy` provided and transforming any error produced using the closure passed.
+        ///
+        /// - Parameters:
+        ///   - policy:        The `SecPolicy` used to evaluate `self`.
+        ///   - errorProducer: The closure used transform the failed `OSStatus` and `SecTrustResultType`.
+        /// - Throws:          Any `Error` from applying the `policy`, or the result of `errorProducer` if validation fails.
+        @available(iOS, introduced: 10, deprecated: 12, renamed: "evaluate(afterApplying:)")
+        @available(macOS, introduced: 10.12, deprecated: 10.14, renamed: "evaluate(afterApplying:)")
+        @available(tvOS, introduced: 10, deprecated: 12, renamed: "evaluate(afterApplying:)")
+        @available(watchOS, introduced: 3, deprecated: 5, renamed: "evaluate(afterApplying:)")
+        func validate(policy: SecPolicy, errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws {
+            try apply(policy: policy).af.validate(errorProducer: errorProducer)
         }
         }
 
 
-        return type
-    }
+        /// Applies a `SecPolicy` to `self`, throwing if it fails.
+        ///
+        /// - Parameter policy: The `SecPolicy`.
+        ///
+        /// - Returns: `self`, with the policy applied.
+        /// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.policyApplicationFailed` reason.
+        func apply(policy: SecPolicy) throws -> SecTrust {
+            let status = SecTrustSetPolicies(type, policy)
+
+            guard status.af.isSuccess else {
+                throw AFError.serverTrustEvaluationFailed(reason: .policyApplicationFailed(trust: type,
+                                                                                           policy: policy,
+                                                                                           status: status))
+            }
 
 
-    /// Evaluate `self`, throwing an `Error` if evaluation fails.
-    ///
-    /// - Throws: `AFError.serverTrustEvaluationFailed` with reason `.trustValidationFailed` and associated error from
-    ///           the underlying evaluation.
-    @available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)
-    public func evaluate() throws {
-        var error: CFError?
-        let evaluationSucceeded = SecTrustEvaluateWithError(type, &error)
+            return type
+        }
 
 
-        if !evaluationSucceeded {
-            throw AFError.serverTrustEvaluationFailed(reason: .trustEvaluationFailed(error: error))
+        /// Evaluate `self`, throwing an `Error` if evaluation fails.
+        ///
+        /// - Throws: `AFError.serverTrustEvaluationFailed` with reason `.trustValidationFailed` and associated error from
+        ///           the underlying evaluation.
+        @available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)
+        func evaluate() throws {
+            var error: CFError?
+            let evaluationSucceeded = SecTrustEvaluateWithError(type, &error)
+
+            if !evaluationSucceeded {
+                throw AFError.serverTrustEvaluationFailed(reason: .trustEvaluationFailed(error: error))
+            }
         }
         }
-    }
 
 
-    /// Validate `self`, passing any failure values through `errorProducer`.
-    ///
-    /// - Parameter errorProducer: The closure used to transform the failed `OSStatus` and `SecTrustResultType` into an
-    ///                            `Error`.
-    /// - Throws:                  The `Error` produced by the `errorProducer` closure.
-    @available(iOS, introduced: 10, deprecated: 12, renamed: "evaluate()")
-    @available(macOS, introduced: 10.12, deprecated: 10.14, renamed: "evaluate()")
-    @available(tvOS, introduced: 10, deprecated: 12, renamed: "evaluate()")
-    @available(watchOS, introduced: 3, deprecated: 5, renamed: "evaluate()")
-    public func validate(errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws {
-        var result = SecTrustResultType.invalid
-        let status = SecTrustEvaluate(type, &result)
-
-        guard status.af.isSuccess && result.af.isSuccess else {
-            throw errorProducer(status, result)
+        /// Validate `self`, passing any failure values through `errorProducer`.
+        ///
+        /// - Parameter errorProducer: The closure used to transform the failed `OSStatus` and `SecTrustResultType` into an
+        ///                            `Error`.
+        /// - Throws:                  The `Error` produced by the `errorProducer` closure.
+        @available(iOS, introduced: 10, deprecated: 12, renamed: "evaluate()")
+        @available(macOS, introduced: 10.12, deprecated: 10.14, renamed: "evaluate()")
+        @available(tvOS, introduced: 10, deprecated: 12, renamed: "evaluate()")
+        @available(watchOS, introduced: 3, deprecated: 5, renamed: "evaluate()")
+        func validate(errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws {
+            var result = SecTrustResultType.invalid
+            let status = SecTrustEvaluate(type, &result)
+
+            guard status.af.isSuccess, result.af.isSuccess else {
+                throw errorProducer(status, result)
+            }
         }
         }
-    }
 
 
-    /// Sets a custom certificate chain on `self`, allowing full validation of a self-signed certificate and its chain.
-    ///
-    /// - Parameter certificates: The `SecCertificate`s to add to the chain.
-    /// - Throws:                 Any error produced when applying the new certificate chain.
-    public func setAnchorCertificates(_ certificates: [SecCertificate]) throws {
-        // Add additional anchor certificates.
-        let status = SecTrustSetAnchorCertificates(type, certificates as CFArray)
-        guard status.af.isSuccess else {
-            throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: status,
-                                                                                               certificates: certificates))
-        }
-
-        // Trust only the set anchor certs.
-        let onlyStatus = SecTrustSetAnchorCertificatesOnly(type, true)
-        guard onlyStatus.af.isSuccess else {
-            throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: onlyStatus,
-                                                                                               certificates: certificates))
+        /// Sets a custom certificate chain on `self`, allowing full validation of a self-signed certificate and its chain.
+        ///
+        /// - Parameter certificates: The `SecCertificate`s to add to the chain.
+        /// - Throws:                 Any error produced when applying the new certificate chain.
+        func setAnchorCertificates(_ certificates: [SecCertificate]) throws {
+            // Add additional anchor certificates.
+            let status = SecTrustSetAnchorCertificates(type, certificates as CFArray)
+            guard status.af.isSuccess else {
+                throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: status,
+                                                                                                   certificates: certificates))
+            }
+
+            // Trust only the set anchor certs.
+            let onlyStatus = SecTrustSetAnchorCertificatesOnly(type, true)
+            guard onlyStatus.af.isSuccess else {
+                throw AFError.serverTrustEvaluationFailed(reason: .settingAnchorCertificatesFailed(status: onlyStatus,
+                                                                                                   certificates: certificates))
+            }
         }
         }
-    }
 
 
-    /// The public keys contained in `self`.
-    public var publicKeys: [SecKey] {
-        certificates.af.publicKeys
-    }
+        /// The public keys contained in `self`.
+        var publicKeys: [SecKey] {
+            certificates.af.publicKeys
+        }
 
 
-    /// The `SecCertificate`s contained i `self`.
-    public var certificates: [SecCertificate] {
-        (0..<SecTrustGetCertificateCount(type)).compactMap { index in
-            SecTrustGetCertificateAtIndex(type, index)
+        /// The `SecCertificate`s contained i `self`.
+        var certificates: [SecCertificate] {
+            (0..<SecTrustGetCertificateCount(type)).compactMap { index in
+                SecTrustGetCertificateAtIndex(type, index)
+            }
         }
         }
-    }
 
 
-    /// The `Data` values for all certificates contained in `self`.
-    public var certificateData: [Data] {
-        certificates.af.data
-    }
+        /// The `Data` values for all certificates contained in `self`.
+        var certificateData: [Data] {
+            certificates.af.data
+        }
 
 
-    /// Validates `self` after applying `SecPolicy.af.default`. This evaluation does not validate the hostname.
-    ///
-    /// - Parameter host: The hostname, used only in the error output if validation fails.
-    /// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.defaultEvaluationFailed` reason.
-    public func performDefaultValidation(forHost host: String) throws {
-        if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {
-            try evaluate(afterApplying: SecPolicy.af.default)
-        } else {
-            try validate(policy: SecPolicy.af.default) { status, result in
-                AFError.serverTrustEvaluationFailed(reason: .defaultEvaluationFailed(output: .init(host, type, status, result)))
+        /// Validates `self` after applying `SecPolicy.af.default`. This evaluation does not validate the hostname.
+        ///
+        /// - Parameter host: The hostname, used only in the error output if validation fails.
+        /// - Throws: An `AFError.serverTrustEvaluationFailed` instance with a `.defaultEvaluationFailed` reason.
+        func performDefaultValidation(forHost host: String) throws {
+            if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {
+                try evaluate(afterApplying: SecPolicy.af.default)
+            } else {
+                try validate(policy: SecPolicy.af.default) { status, result in
+                    AFError.serverTrustEvaluationFailed(reason: .defaultEvaluationFailed(output: .init(host, type, status, result)))
+                }
             }
             }
         }
         }
-    }
 
 
-    /// Validates `self` after applying `SecPolicy.af.hostname(host)`, which performs the default validation as well as
-    /// hostname validation.
-    ///
-    /// - Parameter host: The hostname to use in the validation.
-    /// - Throws:         An `AFError.serverTrustEvaluationFailed` instance with a `.defaultEvaluationFailed` reason.
-    public func performValidation(forHost host: String) throws {
-        if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {
-            try evaluate(afterApplying: SecPolicy.af.hostname(host))
-        } else {
-            try validate(policy: SecPolicy.af.hostname(host)) { status, result in
-                AFError.serverTrustEvaluationFailed(reason: .hostValidationFailed(output: .init(host, type, status, result)))
+        /// Validates `self` after applying `SecPolicy.af.hostname(host)`, which performs the default validation as well as
+        /// hostname validation.
+        ///
+        /// - Parameter host: The hostname to use in the validation.
+        /// - Throws:         An `AFError.serverTrustEvaluationFailed` instance with a `.defaultEvaluationFailed` reason.
+        func performValidation(forHost host: String) throws {
+            if #available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) {
+                try evaluate(afterApplying: SecPolicy.af.hostname(host))
+            } else {
+                try validate(policy: SecPolicy.af.hostname(host)) { status, result in
+                    AFError.serverTrustEvaluationFailed(reason: .hostValidationFailed(output: .init(host, type, status, result)))
+                }
             }
             }
         }
         }
     }
     }
-}
-
-extension SecPolicy: AlamofireExtended {}
-extension AlamofireExtension where ExtendedType == SecPolicy {
-    /// Creates a `SecPolicy` instance which will validate server certificates but not require a host name match.
-    public static let `default` = SecPolicyCreateSSL(true, nil)
 
 
-    /// Creates a `SecPolicy` instance which will validate server certificates and much match the provided hostname.
-    ///
-    /// - Parameter hostname: The hostname to validate against.
-    ///
-    /// - Returns:            The `SecPolicy`.
-    public static func hostname(_ hostname: String) -> SecPolicy {
-        SecPolicyCreateSSL(true, hostname as CFString)
-    }
+    extension SecPolicy: AlamofireExtended {}
+    public extension AlamofireExtension where ExtendedType == SecPolicy {
+        /// Creates a `SecPolicy` instance which will validate server certificates but not require a host name match.
+        static let `default` = SecPolicyCreateSSL(true, nil)
 
 
-    /// Creates a `SecPolicy` which checks the revocation of certificates.
-    ///
-    /// - Parameter options: The `RevocationTrustEvaluator.Options` for evaluation.
-    ///
-    /// - Returns:           The `SecPolicy`.
-    /// - Throws:            An `AFError.serverTrustEvaluationFailed` error with reason `.revocationPolicyCreationFailed`
-    ///                      if the policy cannot be created.
-    public static func revocation(options: RevocationTrustEvaluator.Options) throws -> SecPolicy {
-        guard let policy = SecPolicyCreateRevocation(options.rawValue) else {
-            throw AFError.serverTrustEvaluationFailed(reason: .revocationPolicyCreationFailed)
+        /// Creates a `SecPolicy` instance which will validate server certificates and much match the provided hostname.
+        ///
+        /// - Parameter hostname: The hostname to validate against.
+        ///
+        /// - Returns:            The `SecPolicy`.
+        static func hostname(_ hostname: String) -> SecPolicy {
+            SecPolicyCreateSSL(true, hostname as CFString)
         }
         }
 
 
-        return policy
-    }
-}
+        /// Creates a `SecPolicy` which checks the revocation of certificates.
+        ///
+        /// - Parameter options: The `RevocationTrustEvaluator.Options` for evaluation.
+        ///
+        /// - Returns:           The `SecPolicy`.
+        /// - Throws:            An `AFError.serverTrustEvaluationFailed` error with reason `.revocationPolicyCreationFailed`
+        ///                      if the policy cannot be created.
+        static func revocation(options: RevocationTrustEvaluator.Options) throws -> SecPolicy {
+            guard let policy = SecPolicyCreateRevocation(options.rawValue) else {
+                throw AFError.serverTrustEvaluationFailed(reason: .revocationPolicyCreationFailed)
+            }
 
 
-extension Array: AlamofireExtended {}
-extension AlamofireExtension where ExtendedType == [SecCertificate] {
-    /// All `Data` values for the contained `SecCertificate`s.
-    public var data: [Data] {
-        type.map { SecCertificateCopyData($0) as Data }
+            return policy
+        }
     }
     }
 
 
-    /// All public `SecKey` values for the contained `SecCertificate`s.
-    public var publicKeys: [SecKey] {
-        type.compactMap { $0.af.publicKey }
+    extension Array: AlamofireExtended {}
+    public extension AlamofireExtension where ExtendedType == [SecCertificate] {
+        /// All `Data` values for the contained `SecCertificate`s.
+        var data: [Data] {
+            type.map { SecCertificateCopyData($0) as Data }
+        }
+
+        /// All public `SecKey` values for the contained `SecCertificate`s.
+        var publicKeys: [SecKey] {
+            type.compactMap { $0.af.publicKey }
+        }
     }
     }
-}
 
 
-extension SecCertificate: AlamofireExtended {}
-extension AlamofireExtension where ExtendedType == SecCertificate {
-    /// The public key for `self`, if it can be extracted.
-    public var publicKey: SecKey? {
-        let policy = SecPolicyCreateBasicX509()
-        var trust: SecTrust?
-        let trustCreationStatus = SecTrustCreateWithCertificates(type, policy, &trust)
+    extension SecCertificate: AlamofireExtended {}
+    public extension AlamofireExtension where ExtendedType == SecCertificate {
+        /// The public key for `self`, if it can be extracted.
+        var publicKey: SecKey? {
+            let policy = SecPolicyCreateBasicX509()
+            var trust: SecTrust?
+            let trustCreationStatus = SecTrustCreateWithCertificates(type, policy, &trust)
 
 
-        guard let createdTrust = trust, trustCreationStatus == errSecSuccess else { return nil }
+            guard let createdTrust = trust, trustCreationStatus == errSecSuccess else { return nil }
 
 
-        return SecTrustCopyPublicKey(createdTrust)
+            return SecTrustCopyPublicKey(createdTrust)
+        }
     }
     }
-}
 
 
-extension OSStatus: AlamofireExtended {}
-extension AlamofireExtension where ExtendedType == OSStatus {
-    /// Returns whether `self` is `errSecSuccess`.
-    public var isSuccess: Bool { type == errSecSuccess }
-}
+    extension OSStatus: AlamofireExtended {}
+    public extension AlamofireExtension where ExtendedType == OSStatus {
+        /// Returns whether `self` is `errSecSuccess`.
+        var isSuccess: Bool { type == errSecSuccess }
+    }
 
 
-extension SecTrustResultType: AlamofireExtended {}
-extension AlamofireExtension where ExtendedType == SecTrustResultType {
-    /// Returns whether `self is `.unspecified` or `.proceed`.
-    public var isSuccess: Bool {
-        type == .unspecified || type == .proceed
+    extension SecTrustResultType: AlamofireExtended {}
+    public extension AlamofireExtension where ExtendedType == SecTrustResultType {
+        /// Returns whether `self is `.unspecified` or `.proceed`.
+        var isSuccess: Bool {
+            type == .unspecified || type == .proceed
+        }
     }
     }
-}
 #endif
 #endif

+ 44 - 22
Example/Pods/Alamofire/Source/Session.swift

@@ -115,7 +115,8 @@ open class Session {
                 serverTrustManager: ServerTrustManager? = nil,
                 serverTrustManager: ServerTrustManager? = nil,
                 redirectHandler: RedirectHandler? = nil,
                 redirectHandler: RedirectHandler? = nil,
                 cachedResponseHandler: CachedResponseHandler? = nil,
                 cachedResponseHandler: CachedResponseHandler? = nil,
-                eventMonitors: [EventMonitor] = []) {
+                eventMonitors: [EventMonitor] = [])
+    {
         precondition(session.configuration.identifier == nil,
         precondition(session.configuration.identifier == nil,
                      "Alamofire does not support background URLSessionConfigurations.")
                      "Alamofire does not support background URLSessionConfigurations.")
         precondition(session.delegateQueue.underlyingQueue === rootQueue,
         precondition(session.delegateQueue.underlyingQueue === rootQueue,
@@ -180,7 +181,8 @@ open class Session {
                             serverTrustManager: ServerTrustManager? = nil,
                             serverTrustManager: ServerTrustManager? = nil,
                             redirectHandler: RedirectHandler? = nil,
                             redirectHandler: RedirectHandler? = nil,
                             cachedResponseHandler: CachedResponseHandler? = nil,
                             cachedResponseHandler: CachedResponseHandler? = nil,
-                            eventMonitors: [EventMonitor] = []) {
+                            eventMonitors: [EventMonitor] = [])
+    {
         precondition(configuration.identifier == nil, "Alamofire does not support background URLSessionConfigurations.")
         precondition(configuration.identifier == nil, "Alamofire does not support background URLSessionConfigurations.")
 
 
         let delegateQueue = OperationQueue(maxConcurrentOperationCount: 1, underlyingQueue: rootQueue, name: "org.alamofire.session.sessionDelegateQueue")
         let delegateQueue = OperationQueue(maxConcurrentOperationCount: 1, underlyingQueue: rootQueue, name: "org.alamofire.session.sessionDelegateQueue")
@@ -281,7 +283,8 @@ open class Session {
                       encoding: ParameterEncoding = URLEncoding.default,
                       encoding: ParameterEncoding = URLEncoding.default,
                       headers: HTTPHeaders? = nil,
                       headers: HTTPHeaders? = nil,
                       interceptor: RequestInterceptor? = nil,
                       interceptor: RequestInterceptor? = nil,
-                      requestModifier: RequestModifier? = nil) -> DataRequest {
+                      requestModifier: RequestModifier? = nil) -> DataRequest
+    {
         let convertible = RequestConvertible(url: convertible,
         let convertible = RequestConvertible(url: convertible,
                                              method: method,
                                              method: method,
                                              parameters: parameters,
                                              parameters: parameters,
@@ -327,7 +330,8 @@ open class Session {
                                              encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default,
                                              encoder: ParameterEncoder = URLEncodedFormParameterEncoder.default,
                                              headers: HTTPHeaders? = nil,
                                              headers: HTTPHeaders? = nil,
                                              interceptor: RequestInterceptor? = nil,
                                              interceptor: RequestInterceptor? = nil,
-                                             requestModifier: RequestModifier? = nil) -> DataRequest {
+                                             requestModifier: RequestModifier? = nil) -> DataRequest
+    {
         let convertible = RequestEncodableConvertible(url: convertible,
         let convertible = RequestEncodableConvertible(url: convertible,
                                                       method: method,
                                                       method: method,
                                                       parameters: parameters,
                                                       parameters: parameters,
@@ -385,7 +389,8 @@ open class Session {
                                                    headers: HTTPHeaders? = nil,
                                                    headers: HTTPHeaders? = nil,
                                                    automaticallyCancelOnStreamError: Bool = false,
                                                    automaticallyCancelOnStreamError: Bool = false,
                                                    interceptor: RequestInterceptor? = nil,
                                                    interceptor: RequestInterceptor? = nil,
-                                                   requestModifier: RequestModifier? = nil) -> DataStreamRequest {
+                                                   requestModifier: RequestModifier? = nil) -> DataStreamRequest
+    {
         let convertible = RequestEncodableConvertible(url: convertible,
         let convertible = RequestEncodableConvertible(url: convertible,
                                                       method: method,
                                                       method: method,
                                                       parameters: parameters,
                                                       parameters: parameters,
@@ -417,7 +422,8 @@ open class Session {
                             headers: HTTPHeaders? = nil,
                             headers: HTTPHeaders? = nil,
                             automaticallyCancelOnStreamError: Bool = false,
                             automaticallyCancelOnStreamError: Bool = false,
                             interceptor: RequestInterceptor? = nil,
                             interceptor: RequestInterceptor? = nil,
-                            requestModifier: RequestModifier? = nil) -> DataStreamRequest {
+                            requestModifier: RequestModifier? = nil) -> DataStreamRequest
+    {
         let convertible = RequestEncodableConvertible(url: convertible,
         let convertible = RequestEncodableConvertible(url: convertible,
                                                       method: method,
                                                       method: method,
                                                       parameters: Empty?.none,
                                                       parameters: Empty?.none,
@@ -442,7 +448,8 @@ open class Session {
     /// - Returns:       The created `DataStreamRequest`.
     /// - Returns:       The created `DataStreamRequest`.
     open func streamRequest(_ convertible: URLRequestConvertible,
     open func streamRequest(_ convertible: URLRequestConvertible,
                             automaticallyCancelOnStreamError: Bool = false,
                             automaticallyCancelOnStreamError: Bool = false,
-                            interceptor: RequestInterceptor? = nil) -> DataStreamRequest {
+                            interceptor: RequestInterceptor? = nil) -> DataStreamRequest
+    {
         let request = DataStreamRequest(convertible: convertible,
         let request = DataStreamRequest(convertible: convertible,
                                         automaticallyCancelOnStreamError: automaticallyCancelOnStreamError,
                                         automaticallyCancelOnStreamError: automaticallyCancelOnStreamError,
                                         underlyingQueue: rootQueue,
                                         underlyingQueue: rootQueue,
@@ -483,7 +490,8 @@ open class Session {
                        headers: HTTPHeaders? = nil,
                        headers: HTTPHeaders? = nil,
                        interceptor: RequestInterceptor? = nil,
                        interceptor: RequestInterceptor? = nil,
                        requestModifier: RequestModifier? = nil,
                        requestModifier: RequestModifier? = nil,
-                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {
+                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest
+    {
         let convertible = RequestConvertible(url: convertible,
         let convertible = RequestConvertible(url: convertible,
                                              method: method,
                                              method: method,
                                              parameters: parameters,
                                              parameters: parameters,
@@ -518,7 +526,8 @@ open class Session {
                                               headers: HTTPHeaders? = nil,
                                               headers: HTTPHeaders? = nil,
                                               interceptor: RequestInterceptor? = nil,
                                               interceptor: RequestInterceptor? = nil,
                                               requestModifier: RequestModifier? = nil,
                                               requestModifier: RequestModifier? = nil,
-                                              to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {
+                                              to destination: DownloadRequest.Destination? = nil) -> DownloadRequest
+    {
         let convertible = RequestEncodableConvertible(url: convertible,
         let convertible = RequestEncodableConvertible(url: convertible,
                                                       method: method,
                                                       method: method,
                                                       parameters: parameters,
                                                       parameters: parameters,
@@ -540,7 +549,8 @@ open class Session {
     /// - Returns:       The created `DownloadRequest`.
     /// - Returns:       The created `DownloadRequest`.
     open func download(_ convertible: URLRequestConvertible,
     open func download(_ convertible: URLRequestConvertible,
                        interceptor: RequestInterceptor? = nil,
                        interceptor: RequestInterceptor? = nil,
-                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {
+                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest
+    {
         let request = DownloadRequest(downloadable: .request(convertible),
         let request = DownloadRequest(downloadable: .request(convertible),
                                       underlyingQueue: rootQueue,
                                       underlyingQueue: rootQueue,
                                       serializationQueue: serializationQueue,
                                       serializationQueue: serializationQueue,
@@ -574,7 +584,8 @@ open class Session {
     /// - Returns:       The created `DownloadRequest`.
     /// - Returns:       The created `DownloadRequest`.
     open func download(resumingWith data: Data,
     open func download(resumingWith data: Data,
                        interceptor: RequestInterceptor? = nil,
                        interceptor: RequestInterceptor? = nil,
-                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest {
+                       to destination: DownloadRequest.Destination? = nil) -> DownloadRequest
+    {
         let request = DownloadRequest(downloadable: .resumeData(data),
         let request = DownloadRequest(downloadable: .resumeData(data),
                                       underlyingQueue: rootQueue,
                                       underlyingQueue: rootQueue,
                                       serializationQueue: serializationQueue,
                                       serializationQueue: serializationQueue,
@@ -639,7 +650,8 @@ open class Session {
                      headers: HTTPHeaders? = nil,
                      headers: HTTPHeaders? = nil,
                      interceptor: RequestInterceptor? = nil,
                      interceptor: RequestInterceptor? = nil,
                      fileManager: FileManager = .default,
                      fileManager: FileManager = .default,
-                     requestModifier: RequestModifier? = nil) -> UploadRequest {
+                     requestModifier: RequestModifier? = nil) -> UploadRequest
+    {
         let convertible = ParameterlessRequestConvertible(url: convertible,
         let convertible = ParameterlessRequestConvertible(url: convertible,
                                                           method: method,
                                                           method: method,
                                                           headers: headers,
                                                           headers: headers,
@@ -661,7 +673,8 @@ open class Session {
     open func upload(_ data: Data,
     open func upload(_ data: Data,
                      with convertible: URLRequestConvertible,
                      with convertible: URLRequestConvertible,
                      interceptor: RequestInterceptor? = nil,
                      interceptor: RequestInterceptor? = nil,
-                     fileManager: FileManager = .default) -> UploadRequest {
+                     fileManager: FileManager = .default) -> UploadRequest
+    {
         upload(.data(data), with: convertible, interceptor: interceptor, fileManager: fileManager)
         upload(.data(data), with: convertible, interceptor: interceptor, fileManager: fileManager)
     }
     }
 
 
@@ -688,7 +701,8 @@ open class Session {
                      headers: HTTPHeaders? = nil,
                      headers: HTTPHeaders? = nil,
                      interceptor: RequestInterceptor? = nil,
                      interceptor: RequestInterceptor? = nil,
                      fileManager: FileManager = .default,
                      fileManager: FileManager = .default,
-                     requestModifier: RequestModifier? = nil) -> UploadRequest {
+                     requestModifier: RequestModifier? = nil) -> UploadRequest
+    {
         let convertible = ParameterlessRequestConvertible(url: convertible,
         let convertible = ParameterlessRequestConvertible(url: convertible,
                                                           method: method,
                                                           method: method,
                                                           headers: headers,
                                                           headers: headers,
@@ -711,7 +725,8 @@ open class Session {
     open func upload(_ fileURL: URL,
     open func upload(_ fileURL: URL,
                      with convertible: URLRequestConvertible,
                      with convertible: URLRequestConvertible,
                      interceptor: RequestInterceptor? = nil,
                      interceptor: RequestInterceptor? = nil,
-                     fileManager: FileManager = .default) -> UploadRequest {
+                     fileManager: FileManager = .default) -> UploadRequest
+    {
         upload(.file(fileURL, shouldRemove: false), with: convertible, interceptor: interceptor, fileManager: fileManager)
         upload(.file(fileURL, shouldRemove: false), with: convertible, interceptor: interceptor, fileManager: fileManager)
     }
     }
 
 
@@ -738,7 +753,8 @@ open class Session {
                      headers: HTTPHeaders? = nil,
                      headers: HTTPHeaders? = nil,
                      interceptor: RequestInterceptor? = nil,
                      interceptor: RequestInterceptor? = nil,
                      fileManager: FileManager = .default,
                      fileManager: FileManager = .default,
-                     requestModifier: RequestModifier? = nil) -> UploadRequest {
+                     requestModifier: RequestModifier? = nil) -> UploadRequest
+    {
         let convertible = ParameterlessRequestConvertible(url: convertible,
         let convertible = ParameterlessRequestConvertible(url: convertible,
                                                           method: method,
                                                           method: method,
                                                           headers: headers,
                                                           headers: headers,
@@ -761,7 +777,8 @@ open class Session {
     open func upload(_ stream: InputStream,
     open func upload(_ stream: InputStream,
                      with convertible: URLRequestConvertible,
                      with convertible: URLRequestConvertible,
                      interceptor: RequestInterceptor? = nil,
                      interceptor: RequestInterceptor? = nil,
-                     fileManager: FileManager = .default) -> UploadRequest {
+                     fileManager: FileManager = .default) -> UploadRequest
+    {
         upload(.stream(stream), with: convertible, interceptor: interceptor, fileManager: fileManager)
         upload(.stream(stream), with: convertible, interceptor: interceptor, fileManager: fileManager)
     }
     }
 
 
@@ -805,7 +822,8 @@ open class Session {
                      headers: HTTPHeaders? = nil,
                      headers: HTTPHeaders? = nil,
                      interceptor: RequestInterceptor? = nil,
                      interceptor: RequestInterceptor? = nil,
                      fileManager: FileManager = .default,
                      fileManager: FileManager = .default,
-                     requestModifier: RequestModifier? = nil) -> UploadRequest {
+                     requestModifier: RequestModifier? = nil) -> UploadRequest
+    {
         let convertible = ParameterlessRequestConvertible(url: url,
         let convertible = ParameterlessRequestConvertible(url: url,
                                                           method: method,
                                                           method: method,
                                                           headers: headers,
                                                           headers: headers,
@@ -852,7 +870,8 @@ open class Session {
                      with request: URLRequestConvertible,
                      with request: URLRequestConvertible,
                      usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,
                      usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,
                      interceptor: RequestInterceptor? = nil,
                      interceptor: RequestInterceptor? = nil,
-                     fileManager: FileManager = .default) -> UploadRequest {
+                     fileManager: FileManager = .default) -> UploadRequest
+    {
         let formData = MultipartFormData(fileManager: fileManager)
         let formData = MultipartFormData(fileManager: fileManager)
         multipartFormData(formData)
         multipartFormData(formData)
 
 
@@ -901,7 +920,8 @@ open class Session {
                      headers: HTTPHeaders? = nil,
                      headers: HTTPHeaders? = nil,
                      interceptor: RequestInterceptor? = nil,
                      interceptor: RequestInterceptor? = nil,
                      fileManager: FileManager = .default,
                      fileManager: FileManager = .default,
-                     requestModifier: RequestModifier? = nil) -> UploadRequest {
+                     requestModifier: RequestModifier? = nil) -> UploadRequest
+    {
         let convertible = ParameterlessRequestConvertible(url: url,
         let convertible = ParameterlessRequestConvertible(url: url,
                                                           method: method,
                                                           method: method,
                                                           headers: headers,
                                                           headers: headers,
@@ -945,7 +965,8 @@ open class Session {
                      with request: URLRequestConvertible,
                      with request: URLRequestConvertible,
                      usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,
                      usingThreshold encodingMemoryThreshold: UInt64 = MultipartFormData.encodingMemoryThreshold,
                      interceptor: RequestInterceptor? = nil,
                      interceptor: RequestInterceptor? = nil,
-                     fileManager: FileManager = .default) -> UploadRequest {
+                     fileManager: FileManager = .default) -> UploadRequest
+    {
         let multipartUpload = MultipartUpload(encodingMemoryThreshold: encodingMemoryThreshold,
         let multipartUpload = MultipartUpload(encodingMemoryThreshold: encodingMemoryThreshold,
                                               request: request,
                                               request: request,
                                               multipartFormData: multipartFormData)
                                               multipartFormData: multipartFormData)
@@ -960,7 +981,8 @@ open class Session {
     func upload(_ uploadable: UploadRequest.Uploadable,
     func upload(_ uploadable: UploadRequest.Uploadable,
                 with convertible: URLRequestConvertible,
                 with convertible: URLRequestConvertible,
                 interceptor: RequestInterceptor?,
                 interceptor: RequestInterceptor?,
-                fileManager: FileManager) -> UploadRequest {
+                fileManager: FileManager) -> UploadRequest
+    {
         let uploadable = Upload(request: convertible, uploadable: uploadable)
         let uploadable = Upload(request: convertible, uploadable: uploadable)
 
 
         return upload(uploadable, interceptor: interceptor, fileManager: fileManager)
         return upload(uploadable, interceptor: interceptor, fileManager: fileManager)

+ 42 - 34
Example/Pods/Alamofire/Source/SessionDelegate.swift

@@ -44,7 +44,7 @@ open class SessionDelegate: NSObject {
     /// - Parameters:
     /// - Parameters:
     ///   - task: The `URLSessionTask` for which to find the associated `Request`.
     ///   - task: The `URLSessionTask` for which to find the associated `Request`.
     ///   - type: The `Request` subclass type to cast any `Request` associate with `task`.
     ///   - type: The `Request` subclass type to cast any `Request` associate with `task`.
-    func request<R: Request>(for task: URLSessionTask, as type: R.Type) -> R? {
+    func request<R: Request>(for task: URLSessionTask, as _: R.Type) -> R? {
         guard let provider = stateProvider else {
         guard let provider = stateProvider else {
             assertionFailure("StateProvider is nil.")
             assertionFailure("StateProvider is nil.")
             return nil
             return nil
@@ -86,7 +86,8 @@ extension SessionDelegate: URLSessionTaskDelegate {
     open func urlSession(_ session: URLSession,
     open func urlSession(_ session: URLSession,
                          task: URLSessionTask,
                          task: URLSessionTask,
                          didReceive challenge: URLAuthenticationChallenge,
                          didReceive challenge: URLAuthenticationChallenge,
-                         completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
+                         completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
+    {
         eventMonitor?.urlSession(session, task: task, didReceive: challenge)
         eventMonitor?.urlSession(session, task: task, didReceive: challenge)
 
 
         let evaluation: ChallengeEvaluation
         let evaluation: ChallengeEvaluation
@@ -95,10 +96,10 @@ extension SessionDelegate: URLSessionTaskDelegate {
              NSURLAuthenticationMethodNegotiate:
              NSURLAuthenticationMethodNegotiate:
             evaluation = attemptCredentialAuthentication(for: challenge, belongingTo: task)
             evaluation = attemptCredentialAuthentication(for: challenge, belongingTo: task)
         #if !(os(Linux) || os(Windows))
         #if !(os(Linux) || os(Windows))
-        case NSURLAuthenticationMethodServerTrust:
-            evaluation = attemptServerTrustAuthentication(with: challenge)
-        case NSURLAuthenticationMethodClientCertificate:
-            evaluation = attemptCredentialAuthentication(for: challenge, belongingTo: task)
+            case NSURLAuthenticationMethodServerTrust:
+                evaluation = attemptServerTrustAuthentication(with: challenge)
+            case NSURLAuthenticationMethodClientCertificate:
+                evaluation = attemptCredentialAuthentication(for: challenge, belongingTo: task)
         #endif
         #endif
         default:
         default:
             evaluation = (.performDefaultHandling, nil, nil)
             evaluation = (.performDefaultHandling, nil, nil)
@@ -112,32 +113,32 @@ extension SessionDelegate: URLSessionTaskDelegate {
     }
     }
 
 
     #if !(os(Linux) || os(Windows))
     #if !(os(Linux) || os(Windows))
-    /// Evaluates the server trust `URLAuthenticationChallenge` received.
-    ///
-    /// - Parameter challenge: The `URLAuthenticationChallenge`.
-    ///
-    /// - Returns:             The `ChallengeEvaluation`.
-    func attemptServerTrustAuthentication(with challenge: URLAuthenticationChallenge) -> ChallengeEvaluation {
-        let host = challenge.protectionSpace.host
-
-        guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust,
-              let trust = challenge.protectionSpace.serverTrust
-        else {
-            return (.performDefaultHandling, nil, nil)
-        }
-
-        do {
-            guard let evaluator = try stateProvider?.serverTrustManager?.serverTrustEvaluator(forHost: host) else {
+        /// Evaluates the server trust `URLAuthenticationChallenge` received.
+        ///
+        /// - Parameter challenge: The `URLAuthenticationChallenge`.
+        ///
+        /// - Returns:             The `ChallengeEvaluation`.
+        func attemptServerTrustAuthentication(with challenge: URLAuthenticationChallenge) -> ChallengeEvaluation {
+            let host = challenge.protectionSpace.host
+
+            guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust,
+                  let trust = challenge.protectionSpace.serverTrust
+            else {
                 return (.performDefaultHandling, nil, nil)
                 return (.performDefaultHandling, nil, nil)
             }
             }
 
 
-            try evaluator.evaluate(trust, forHost: host)
+            do {
+                guard let evaluator = try stateProvider?.serverTrustManager?.serverTrustEvaluator(forHost: host) else {
+                    return (.performDefaultHandling, nil, nil)
+                }
 
 
-            return (.useCredential, URLCredential(trust: trust), nil)
-        } catch {
-            return (.cancelAuthenticationChallenge, nil, error.asAFError(or: .serverTrustEvaluationFailed(reason: .customEvaluationFailed(error: error))))
+                try evaluator.evaluate(trust, forHost: host)
+
+                return (.useCredential, URLCredential(trust: trust), nil)
+            } catch {
+                return (.cancelAuthenticationChallenge, nil, error.asAFError(or: .serverTrustEvaluationFailed(reason: .customEvaluationFailed(error: error))))
+            }
         }
         }
-    }
     #endif
     #endif
 
 
     /// Evaluates the credential-based authentication `URLAuthenticationChallenge` received for `task`.
     /// Evaluates the credential-based authentication `URLAuthenticationChallenge` received for `task`.
@@ -148,7 +149,8 @@ extension SessionDelegate: URLSessionTaskDelegate {
     ///
     ///
     /// - Returns:     The `ChallengeEvaluation`.
     /// - Returns:     The `ChallengeEvaluation`.
     func attemptCredentialAuthentication(for challenge: URLAuthenticationChallenge,
     func attemptCredentialAuthentication(for challenge: URLAuthenticationChallenge,
-                                         belongingTo task: URLSessionTask) -> ChallengeEvaluation {
+                                         belongingTo task: URLSessionTask) -> ChallengeEvaluation
+    {
         guard challenge.previousFailureCount == 0 else {
         guard challenge.previousFailureCount == 0 else {
             return (.rejectProtectionSpace, nil, nil)
             return (.rejectProtectionSpace, nil, nil)
         }
         }
@@ -164,7 +166,8 @@ extension SessionDelegate: URLSessionTaskDelegate {
                          task: URLSessionTask,
                          task: URLSessionTask,
                          didSendBodyData bytesSent: Int64,
                          didSendBodyData bytesSent: Int64,
                          totalBytesSent: Int64,
                          totalBytesSent: Int64,
-                         totalBytesExpectedToSend: Int64) {
+                         totalBytesExpectedToSend: Int64)
+    {
         eventMonitor?.urlSession(session,
         eventMonitor?.urlSession(session,
                                  task: task,
                                  task: task,
                                  didSendBodyData: bytesSent,
                                  didSendBodyData: bytesSent,
@@ -177,7 +180,8 @@ extension SessionDelegate: URLSessionTaskDelegate {
 
 
     open func urlSession(_ session: URLSession,
     open func urlSession(_ session: URLSession,
                          task: URLSessionTask,
                          task: URLSessionTask,
-                         needNewBodyStream completionHandler: @escaping (InputStream?) -> Void) {
+                         needNewBodyStream completionHandler: @escaping (InputStream?) -> Void)
+    {
         eventMonitor?.urlSession(session, taskNeedsNewBodyStream: task)
         eventMonitor?.urlSession(session, taskNeedsNewBodyStream: task)
 
 
         guard let request = request(for: task, as: UploadRequest.self) else {
         guard let request = request(for: task, as: UploadRequest.self) else {
@@ -193,7 +197,8 @@ extension SessionDelegate: URLSessionTaskDelegate {
                          task: URLSessionTask,
                          task: URLSessionTask,
                          willPerformHTTPRedirection response: HTTPURLResponse,
                          willPerformHTTPRedirection response: HTTPURLResponse,
                          newRequest request: URLRequest,
                          newRequest request: URLRequest,
-                         completionHandler: @escaping (URLRequest?) -> Void) {
+                         completionHandler: @escaping (URLRequest?) -> Void)
+    {
         eventMonitor?.urlSession(session, task: task, willPerformHTTPRedirection: response, newRequest: request)
         eventMonitor?.urlSession(session, task: task, willPerformHTTPRedirection: response, newRequest: request)
 
 
         if let redirectHandler = stateProvider?.request(for: task)?.redirectHandler ?? stateProvider?.redirectHandler {
         if let redirectHandler = stateProvider?.request(for: task)?.redirectHandler ?? stateProvider?.redirectHandler {
@@ -246,7 +251,8 @@ extension SessionDelegate: URLSessionDataDelegate {
     open func urlSession(_ session: URLSession,
     open func urlSession(_ session: URLSession,
                          dataTask: URLSessionDataTask,
                          dataTask: URLSessionDataTask,
                          willCacheResponse proposedResponse: CachedURLResponse,
                          willCacheResponse proposedResponse: CachedURLResponse,
-                         completionHandler: @escaping (CachedURLResponse?) -> Void) {
+                         completionHandler: @escaping (CachedURLResponse?) -> Void)
+    {
         eventMonitor?.urlSession(session, dataTask: dataTask, willCacheResponse: proposedResponse)
         eventMonitor?.urlSession(session, dataTask: dataTask, willCacheResponse: proposedResponse)
 
 
         if let handler = stateProvider?.request(for: dataTask)?.cachedResponseHandler ?? stateProvider?.cachedResponseHandler {
         if let handler = stateProvider?.request(for: dataTask)?.cachedResponseHandler ?? stateProvider?.cachedResponseHandler {
@@ -263,7 +269,8 @@ extension SessionDelegate: URLSessionDownloadDelegate {
     open func urlSession(_ session: URLSession,
     open func urlSession(_ session: URLSession,
                          downloadTask: URLSessionDownloadTask,
                          downloadTask: URLSessionDownloadTask,
                          didResumeAtOffset fileOffset: Int64,
                          didResumeAtOffset fileOffset: Int64,
-                         expectedTotalBytes: Int64) {
+                         expectedTotalBytes: Int64)
+    {
         eventMonitor?.urlSession(session,
         eventMonitor?.urlSession(session,
                                  downloadTask: downloadTask,
                                  downloadTask: downloadTask,
                                  didResumeAtOffset: fileOffset,
                                  didResumeAtOffset: fileOffset,
@@ -281,7 +288,8 @@ extension SessionDelegate: URLSessionDownloadDelegate {
                          downloadTask: URLSessionDownloadTask,
                          downloadTask: URLSessionDownloadTask,
                          didWriteData bytesWritten: Int64,
                          didWriteData bytesWritten: Int64,
                          totalBytesWritten: Int64,
                          totalBytesWritten: Int64,
-                         totalBytesExpectedToWrite: Int64) {
+                         totalBytesExpectedToWrite: Int64)
+    {
         eventMonitor?.urlSession(session,
         eventMonitor?.urlSession(session,
                                  downloadTask: downloadTask,
                                  downloadTask: downloadTask,
                                  didWriteData: bytesWritten,
                                  didWriteData: bytesWritten,

+ 4 - 4
Example/Pods/Alamofire/Source/URLConvertible+URLRequestConvertible.swift

@@ -74,9 +74,9 @@ public protocol URLRequestConvertible {
     func asURLRequest() throws -> URLRequest
     func asURLRequest() throws -> URLRequest
 }
 }
 
 
-extension URLRequestConvertible {
+public extension URLRequestConvertible {
     /// The `URLRequest` returned by discarding any `Error` encountered.
     /// The `URLRequest` returned by discarding any `Error` encountered.
-    public var urlRequest: URLRequest? { try? asURLRequest() }
+    var urlRequest: URLRequest? { try? asURLRequest() }
 }
 }
 
 
 extension URLRequest: URLRequestConvertible {
 extension URLRequest: URLRequestConvertible {
@@ -86,7 +86,7 @@ extension URLRequest: URLRequestConvertible {
 
 
 // MARK: -
 // MARK: -
 
 
-extension URLRequest {
+public extension URLRequest {
     /// Creates an instance with the specified `url`, `method`, and `headers`.
     /// Creates an instance with the specified `url`, `method`, and `headers`.
     ///
     ///
     /// - Parameters:
     /// - Parameters:
@@ -94,7 +94,7 @@ extension URLRequest {
     ///   - method:  The `HTTPMethod`.
     ///   - method:  The `HTTPMethod`.
     ///   - headers: The `HTTPHeaders`, `nil` by default.
     ///   - headers: The `HTTPHeaders`, `nil` by default.
     /// - Throws:    Any error thrown while converting the `URLConvertible` to a `URL`.
     /// - Throws:    Any error thrown while converting the `URLConvertible` to a `URL`.
-    public init(url: URLConvertible, method: HTTPMethod, headers: HTTPHeaders? = nil) throws {
+    init(url: URLConvertible, method: HTTPMethod, headers: HTTPHeaders? = nil) throws {
         let url = try url.asURL()
         let url = try url.asURL()
 
 
         self.init(url: url)
         self.init(url: url)

+ 17 - 11
Example/Pods/Alamofire/Source/URLEncodedFormEncoder.swift

@@ -340,7 +340,8 @@ public final class URLEncodedFormEncoder {
                 dateEncoding: DateEncoding = .deferredToDate,
                 dateEncoding: DateEncoding = .deferredToDate,
                 keyEncoding: KeyEncoding = .useDefaultKeys,
                 keyEncoding: KeyEncoding = .useDefaultKeys,
                 spaceEncoding: SpaceEncoding = .percentEscaped,
                 spaceEncoding: SpaceEncoding = .percentEscaped,
-                allowedCharacters: CharacterSet = .afURLQueryAllowed) {
+                allowedCharacters: CharacterSet = .afURLQueryAllowed)
+    {
         self.alphabetizeKeyValuePairs = alphabetizeKeyValuePairs
         self.alphabetizeKeyValuePairs = alphabetizeKeyValuePairs
         self.arrayEncoding = arrayEncoding
         self.arrayEncoding = arrayEncoding
         self.boolEncoding = boolEncoding
         self.boolEncoding = boolEncoding
@@ -415,7 +416,8 @@ final class _URLEncodedFormEncoder {
          codingPath: [CodingKey] = [],
          codingPath: [CodingKey] = [],
          boolEncoding: URLEncodedFormEncoder.BoolEncoding,
          boolEncoding: URLEncodedFormEncoder.BoolEncoding,
          dataEncoding: URLEncodedFormEncoder.DataEncoding,
          dataEncoding: URLEncodedFormEncoder.DataEncoding,
-         dateEncoding: URLEncodedFormEncoder.DateEncoding) {
+         dateEncoding: URLEncodedFormEncoder.DateEncoding)
+    {
         self.context = context
         self.context = context
         self.codingPath = codingPath
         self.codingPath = codingPath
         self.boolEncoding = boolEncoding
         self.boolEncoding = boolEncoding
@@ -425,7 +427,7 @@ final class _URLEncodedFormEncoder {
 }
 }
 
 
 extension _URLEncodedFormEncoder: Encoder {
 extension _URLEncodedFormEncoder: Encoder {
-    func container<Key>(keyedBy type: Key.Type) -> KeyedEncodingContainer<Key> where Key: CodingKey {
+    func container<Key>(keyedBy _: Key.Type) -> KeyedEncodingContainer<Key> where Key: CodingKey {
         let container = _URLEncodedFormEncoder.KeyedContainer<Key>(context: context,
         let container = _URLEncodedFormEncoder.KeyedContainer<Key>(context: context,
                                                                    codingPath: codingPath,
                                                                    codingPath: codingPath,
                                                                    boolEncoding: boolEncoding,
                                                                    boolEncoding: boolEncoding,
@@ -583,7 +585,8 @@ extension _URLEncodedFormEncoder {
              codingPath: [CodingKey],
              codingPath: [CodingKey],
              boolEncoding: URLEncodedFormEncoder.BoolEncoding,
              boolEncoding: URLEncodedFormEncoder.BoolEncoding,
              dataEncoding: URLEncodedFormEncoder.DataEncoding,
              dataEncoding: URLEncodedFormEncoder.DataEncoding,
-             dateEncoding: URLEncodedFormEncoder.DateEncoding) {
+             dateEncoding: URLEncodedFormEncoder.DateEncoding)
+        {
             self.context = context
             self.context = context
             self.codingPath = codingPath
             self.codingPath = codingPath
             self.boolEncoding = boolEncoding
             self.boolEncoding = boolEncoding
@@ -629,7 +632,7 @@ extension _URLEncodedFormEncoder.KeyedContainer: KeyedEncodingContainerProtocol
         return container
         return container
     }
     }
 
 
-    func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type, forKey key: Key) -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey {
+    func nestedContainer<NestedKey>(keyedBy _: NestedKey.Type, forKey key: Key) -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey {
         let container = _URLEncodedFormEncoder.KeyedContainer<NestedKey>(context: context,
         let container = _URLEncodedFormEncoder.KeyedContainer<NestedKey>(context: context,
                                                                          codingPath: nestedCodingPath(for: key),
                                                                          codingPath: nestedCodingPath(for: key),
                                                                          boolEncoding: boolEncoding,
                                                                          boolEncoding: boolEncoding,
@@ -671,7 +674,8 @@ extension _URLEncodedFormEncoder {
              codingPath: [CodingKey],
              codingPath: [CodingKey],
              boolEncoding: URLEncodedFormEncoder.BoolEncoding,
              boolEncoding: URLEncodedFormEncoder.BoolEncoding,
              dataEncoding: URLEncodedFormEncoder.DataEncoding,
              dataEncoding: URLEncodedFormEncoder.DataEncoding,
-             dateEncoding: URLEncodedFormEncoder.DateEncoding) {
+             dateEncoding: URLEncodedFormEncoder.DateEncoding)
+        {
             self.context = context
             self.context = context
             self.codingPath = codingPath
             self.codingPath = codingPath
             self.boolEncoding = boolEncoding
             self.boolEncoding = boolEncoding
@@ -817,7 +821,8 @@ extension _URLEncodedFormEncoder {
              codingPath: [CodingKey],
              codingPath: [CodingKey],
              boolEncoding: URLEncodedFormEncoder.BoolEncoding,
              boolEncoding: URLEncodedFormEncoder.BoolEncoding,
              dataEncoding: URLEncodedFormEncoder.DataEncoding,
              dataEncoding: URLEncodedFormEncoder.DataEncoding,
-             dateEncoding: URLEncodedFormEncoder.DateEncoding) {
+             dateEncoding: URLEncodedFormEncoder.DateEncoding)
+        {
             self.context = context
             self.context = context
             self.codingPath = codingPath
             self.codingPath = codingPath
             self.boolEncoding = boolEncoding
             self.boolEncoding = boolEncoding
@@ -849,7 +854,7 @@ extension _URLEncodedFormEncoder.UnkeyedContainer: UnkeyedEncodingContainer {
                                                            dateEncoding: dateEncoding)
                                                            dateEncoding: dateEncoding)
     }
     }
 
 
-    func nestedContainer<NestedKey>(keyedBy keyType: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey {
+    func nestedContainer<NestedKey>(keyedBy _: NestedKey.Type) -> KeyedEncodingContainer<NestedKey> where NestedKey: CodingKey {
         defer { count += 1 }
         defer { count += 1 }
         let container = _URLEncodedFormEncoder.KeyedContainer<NestedKey>(context: context,
         let container = _URLEncodedFormEncoder.KeyedContainer<NestedKey>(context: context,
                                                                          codingPath: nestedCodingPath,
                                                                          codingPath: nestedCodingPath,
@@ -892,7 +897,8 @@ final class URLEncodedFormSerializer {
          arrayEncoding: URLEncodedFormEncoder.ArrayEncoding,
          arrayEncoding: URLEncodedFormEncoder.ArrayEncoding,
          keyEncoding: URLEncodedFormEncoder.KeyEncoding,
          keyEncoding: URLEncodedFormEncoder.KeyEncoding,
          spaceEncoding: URLEncodedFormEncoder.SpaceEncoding,
          spaceEncoding: URLEncodedFormEncoder.SpaceEncoding,
-         allowedCharacters: CharacterSet) {
+         allowedCharacters: CharacterSet)
+    {
         self.alphabetizeKeyValuePairs = alphabetizeKeyValuePairs
         self.alphabetizeKeyValuePairs = alphabetizeKeyValuePairs
         self.arrayEncoding = arrayEncoding
         self.arrayEncoding = arrayEncoding
         self.keyEncoding = keyEncoding
         self.keyEncoding = keyEncoding
@@ -955,7 +961,7 @@ extension Array where Element == String {
     }
     }
 }
 }
 
 
-extension CharacterSet {
+public extension CharacterSet {
     /// Creates a CharacterSet from RFC 3986 allowed characters.
     /// Creates a CharacterSet from RFC 3986 allowed characters.
     ///
     ///
     /// RFC 3986 states that the following characters are "reserved" characters.
     /// RFC 3986 states that the following characters are "reserved" characters.
@@ -966,7 +972,7 @@ extension CharacterSet {
     /// In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow
     /// In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow
     /// query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/"
     /// query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/"
     /// should be percent-escaped in the query string.
     /// should be percent-escaped in the query string.
-    public static let afURLQueryAllowed: CharacterSet = {
+    static let afURLQueryAllowed: CharacterSet = {
         let generalDelimitersToEncode = ":#[]@" // does not include "?" or "/" due to RFC 3986 - Section 3.4
         let generalDelimitersToEncode = ":#[]@" // does not include "?" or "/" due to RFC 3986 - Section 3.4
         let subDelimitersToEncode = "!$&'()*+,;="
         let subDelimitersToEncode = "!$&'()*+,;="
         let encodableDelimiters = CharacterSet(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)")
         let encodableDelimiters = CharacterSet(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)")

+ 3 - 3
Example/Pods/Alamofire/Source/URLRequest+Alamofire.swift

@@ -24,14 +24,14 @@
 
 
 import Foundation
 import Foundation
 
 
-extension URLRequest {
+public extension URLRequest {
     /// Returns the `httpMethod` as Alamofire's `HTTPMethod` type.
     /// Returns the `httpMethod` as Alamofire's `HTTPMethod` type.
-    public var method: HTTPMethod? {
+    var method: HTTPMethod? {
         get { httpMethod.flatMap(HTTPMethod.init) }
         get { httpMethod.flatMap(HTTPMethod.init) }
         set { httpMethod = newValue?.rawValue }
         set { httpMethod = newValue?.rawValue }
     }
     }
 
 
-    public func validate() throws {
+    func validate() throws {
         if method == .get, let bodyData = httpBody {
         if method == .get, let bodyData = httpBody {
             throw AFError.urlRequestValidationFailed(reason: .bodyDataInGETRequest(bodyData))
             throw AFError.urlRequestValidationFailed(reason: .bodyDataInGETRequest(bodyData))
         }
         }

+ 3 - 3
Example/Pods/Alamofire/Source/URLSessionConfiguration+Alamofire.swift

@@ -25,10 +25,10 @@
 import Foundation
 import Foundation
 
 
 extension URLSessionConfiguration: AlamofireExtended {}
 extension URLSessionConfiguration: AlamofireExtended {}
-extension AlamofireExtension where ExtendedType: URLSessionConfiguration {
+public extension AlamofireExtension where ExtendedType: URLSessionConfiguration {
     /// Alamofire's default configuration. Same as `URLSessionConfiguration.default` but adds Alamofire default
     /// Alamofire's default configuration. Same as `URLSessionConfiguration.default` but adds Alamofire default
     /// `Accept-Language`, `Accept-Encoding`, and `User-Agent` headers.
     /// `Accept-Language`, `Accept-Encoding`, and `User-Agent` headers.
-    public static var `default`: URLSessionConfiguration {
+    static var `default`: URLSessionConfiguration {
         let configuration = URLSessionConfiguration.default
         let configuration = URLSessionConfiguration.default
         configuration.headers = .default
         configuration.headers = .default
 
 
@@ -37,7 +37,7 @@ extension AlamofireExtension where ExtendedType: URLSessionConfiguration {
 
 
     /// `.ephemeral` configuration with Alamofire's default `Accept-Language`, `Accept-Encoding`, and `User-Agent`
     /// `.ephemeral` configuration with Alamofire's default `Accept-Language`, `Accept-Encoding`, and `User-Agent`
     /// headers.
     /// headers.
-    public static var ephemeral: URLSessionConfiguration {
+    static var ephemeral: URLSessionConfiguration {
         let configuration = URLSessionConfiguration.ephemeral
         let configuration = URLSessionConfiguration.ephemeral
         configuration.headers = .default
         configuration.headers = .default
 
 

+ 23 - 20
Example/Pods/Alamofire/Source/Validation.swift

@@ -81,7 +81,8 @@ extension Request {
     fileprivate func validate<S: Sequence>(statusCode acceptableStatusCodes: S,
     fileprivate func validate<S: Sequence>(statusCode acceptableStatusCodes: S,
                                            response: HTTPURLResponse)
                                            response: HTTPURLResponse)
         -> ValidationResult
         -> ValidationResult
-        where S.Iterator.Element == Int {
+        where S.Iterator.Element == Int
+    {
         if acceptableStatusCodes.contains(response.statusCode) {
         if acceptableStatusCodes.contains(response.statusCode) {
             return .success(())
             return .success(())
         } else {
         } else {
@@ -96,7 +97,8 @@ extension Request {
                                            response: HTTPURLResponse,
                                            response: HTTPURLResponse,
                                            data: Data?)
                                            data: Data?)
         -> ValidationResult
         -> ValidationResult
-        where S.Iterator.Element == String {
+        where S.Iterator.Element == String
+    {
         guard let data = data, !data.isEmpty else { return .success(()) }
         guard let data = data, !data.isEmpty else { return .success(()) }
 
 
         return validate(contentType: acceptableContentTypes, response: response)
         return validate(contentType: acceptableContentTypes, response: response)
@@ -105,7 +107,8 @@ extension Request {
     fileprivate func validate<S: Sequence>(contentType acceptableContentTypes: S,
     fileprivate func validate<S: Sequence>(contentType acceptableContentTypes: S,
                                            response: HTTPURLResponse)
                                            response: HTTPURLResponse)
         -> ValidationResult
         -> ValidationResult
-        where S.Iterator.Element == String {
+        where S.Iterator.Element == String
+    {
         guard
         guard
             let responseContentType = response.mimeType,
             let responseContentType = response.mimeType,
             let responseMIMEType = MIMEType(responseContentType)
             let responseMIMEType = MIMEType(responseContentType)
@@ -143,10 +146,10 @@ extension Request {
 
 
 // MARK: -
 // MARK: -
 
 
-extension DataRequest {
+public extension DataRequest {
     /// A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the
     /// A closure used to validate a request that takes a URL request, a URL response and data, and returns whether the
     /// request was valid.
     /// request was valid.
-    public typealias Validation = (URLRequest?, HTTPURLResponse, Data?) -> ValidationResult
+    typealias Validation = (URLRequest?, HTTPURLResponse, Data?) -> ValidationResult
 
 
     /// Validates that the response has a status code in the specified sequence.
     /// Validates that the response has a status code in the specified sequence.
     ///
     ///
@@ -156,7 +159,7 @@ extension DataRequest {
     ///
     ///
     /// - Returns:              The instance.
     /// - Returns:              The instance.
     @discardableResult
     @discardableResult
-    public func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {
+    func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {
         validate { [unowned self] _, response, _ in
         validate { [unowned self] _, response, _ in
             self.validate(statusCode: acceptableStatusCodes, response: response)
             self.validate(statusCode: acceptableStatusCodes, response: response)
         }
         }
@@ -170,7 +173,7 @@ extension DataRequest {
     ///
     ///
     /// - returns: The request.
     /// - returns: The request.
     @discardableResult
     @discardableResult
-    public func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {
+    func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {
         validate { [unowned self] _, response, data in
         validate { [unowned self] _, response, data in
             self.validate(contentType: acceptableContentTypes(), response: response, data: data)
             self.validate(contentType: acceptableContentTypes(), response: response, data: data)
         }
         }
@@ -183,7 +186,7 @@ extension DataRequest {
     ///
     ///
     /// - returns: The request.
     /// - returns: The request.
     @discardableResult
     @discardableResult
-    public func validate() -> Self {
+    func validate() -> Self {
         let contentTypes: () -> [String] = { [unowned self] in
         let contentTypes: () -> [String] = { [unowned self] in
             self.acceptableContentTypes
             self.acceptableContentTypes
         }
         }
@@ -191,10 +194,10 @@ extension DataRequest {
     }
     }
 }
 }
 
 
-extension DataStreamRequest {
+public extension DataStreamRequest {
     /// A closure used to validate a request that takes a `URLRequest` and `HTTPURLResponse` and returns whether the
     /// A closure used to validate a request that takes a `URLRequest` and `HTTPURLResponse` and returns whether the
     /// request was valid.
     /// request was valid.
-    public typealias Validation = (_ request: URLRequest?, _ response: HTTPURLResponse) -> ValidationResult
+    typealias Validation = (_ request: URLRequest?, _ response: HTTPURLResponse) -> ValidationResult
 
 
     /// Validates that the response has a status code in the specified sequence.
     /// Validates that the response has a status code in the specified sequence.
     ///
     ///
@@ -204,7 +207,7 @@ extension DataStreamRequest {
     ///
     ///
     /// - Returns:              The instance.
     /// - Returns:              The instance.
     @discardableResult
     @discardableResult
-    public func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {
+    func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {
         validate { [unowned self] _, response in
         validate { [unowned self] _, response in
             self.validate(statusCode: acceptableStatusCodes, response: response)
             self.validate(statusCode: acceptableStatusCodes, response: response)
         }
         }
@@ -218,7 +221,7 @@ extension DataStreamRequest {
     ///
     ///
     /// - returns: The request.
     /// - returns: The request.
     @discardableResult
     @discardableResult
-    public func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {
+    func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {
         validate { [unowned self] _, response in
         validate { [unowned self] _, response in
             self.validate(contentType: acceptableContentTypes(), response: response)
             self.validate(contentType: acceptableContentTypes(), response: response)
         }
         }
@@ -231,7 +234,7 @@ extension DataStreamRequest {
     ///
     ///
     /// - Returns: The instance.
     /// - Returns: The instance.
     @discardableResult
     @discardableResult
-    public func validate() -> Self {
+    func validate() -> Self {
         let contentTypes: () -> [String] = { [unowned self] in
         let contentTypes: () -> [String] = { [unowned self] in
             self.acceptableContentTypes
             self.acceptableContentTypes
         }
         }
@@ -241,12 +244,12 @@ extension DataStreamRequest {
 
 
 // MARK: -
 // MARK: -
 
 
-extension DownloadRequest {
+public extension DownloadRequest {
     /// A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a
     /// A closure used to validate a request that takes a URL request, a URL response, a temporary URL and a
     /// destination URL, and returns whether the request was valid.
     /// destination URL, and returns whether the request was valid.
-    public typealias Validation = (_ request: URLRequest?,
-                                   _ response: HTTPURLResponse,
-                                   _ fileURL: URL?)
+    typealias Validation = (_ request: URLRequest?,
+                            _ response: HTTPURLResponse,
+                            _ fileURL: URL?)
         -> ValidationResult
         -> ValidationResult
 
 
     /// Validates that the response has a status code in the specified sequence.
     /// Validates that the response has a status code in the specified sequence.
@@ -257,7 +260,7 @@ extension DownloadRequest {
     ///
     ///
     /// - Returns:              The instance.
     /// - Returns:              The instance.
     @discardableResult
     @discardableResult
-    public func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {
+    func validate<S: Sequence>(statusCode acceptableStatusCodes: S) -> Self where S.Iterator.Element == Int {
         validate { [unowned self] _, response, _ in
         validate { [unowned self] _, response, _ in
             self.validate(statusCode: acceptableStatusCodes, response: response)
             self.validate(statusCode: acceptableStatusCodes, response: response)
         }
         }
@@ -271,7 +274,7 @@ extension DownloadRequest {
     ///
     ///
     /// - returns: The request.
     /// - returns: The request.
     @discardableResult
     @discardableResult
-    public func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {
+    func validate<S: Sequence>(contentType acceptableContentTypes: @escaping @autoclosure () -> S) -> Self where S.Iterator.Element == String {
         validate { [unowned self] _, response, fileURL in
         validate { [unowned self] _, response, fileURL in
             guard let validFileURL = fileURL else {
             guard let validFileURL = fileURL else {
                 return .failure(AFError.responseValidationFailed(reason: .dataFileNil))
                 return .failure(AFError.responseValidationFailed(reason: .dataFileNil))
@@ -293,7 +296,7 @@ extension DownloadRequest {
     ///
     ///
     /// - returns: The request.
     /// - returns: The request.
     @discardableResult
     @discardableResult
-    public func validate() -> Self {
+    func validate() -> Self {
         let contentTypes = { [unowned self] in
         let contentTypes = { [unowned self] in
             self.acceptableContentTypes
             self.acceptableContentTypes
         }
         }

+ 5 - 7
Example/Tests/Tests.swift

@@ -1,28 +1,26 @@
-import XCTest
 import BFNetRequestKit
 import BFNetRequestKit
+import XCTest
 
 
 class Tests: XCTestCase {
 class Tests: XCTestCase {
-    
     override func setUp() {
     override func setUp() {
         super.setUp()
         super.setUp()
         // Put setup code here. This method is called before the invocation of each test method in the class.
         // Put setup code here. This method is called before the invocation of each test method in the class.
     }
     }
-    
+
     override func tearDown() {
     override func tearDown() {
         // Put teardown code here. This method is called after the invocation of each test method in the class.
         // Put teardown code here. This method is called after the invocation of each test method in the class.
         super.tearDown()
         super.tearDown()
     }
     }
-    
+
     func testExample() {
     func testExample() {
         // This is an example of a functional test case.
         // This is an example of a functional test case.
         XCTAssert(true, "Pass")
         XCTAssert(true, "Pass")
     }
     }
-    
+
     func testPerformanceExample() {
     func testPerformanceExample() {
         // This is an example of a performance test case.
         // This is an example of a performance test case.
-        self.measure() {
+        measure {
             // Put the code you want to measure the time of here.
             // Put the code you want to measure the time of here.
         }
         }
     }
     }
-    
 }
 }

+ 67 - 0
rules.swiftformat

@@ -0,0 +1,67 @@
+--allman false
+--assetliterals visual-width
+--beforemarks 
+--binarygrouping 4,8
+--categorymark "MARK: %c"
+--classthreshold 0
+--closingparen balanced
+--commas always
+--conflictmarkers reject
+--decimalgrouping 3,6
+--elseposition same-line
+--enumthreshold 0
+--exponentcase lowercase
+--exponentgrouping disabled
+--extensionacl on-extension
+--extensionlength 0
+--extensionmark "MARK: - %t + %c"
+--fractiongrouping disabled
+--fragment false
+--funcattributes preserve
+--groupedextension "MARK: %c"
+--guardelse auto
+--header ignore
+--hexgrouping 4,8
+--hexliteralcase uppercase
+--ifdef indent
+--importgrouping alphabetized
+--indent 4
+--indentcase false
+--lifecycle 
+--linebreaks lf
+--markextensions always
+--marktypes always
+--maxwidth none
+--modifierorder 
+--nevertrailing 
+--nospaceoperators 
+--nowrapoperators 
+--octalgrouping 4,8
+--operatorfunc spaced
+--organizetypes class,enum,struct
+--patternlet hoist
+--ranges spaced
+--redundanttype inferred
+--self remove
+--selfrequired 
+--semicolons inline
+--shortoptionals always
+--smarttabs enabled
+--stripunusedargs always
+--structthreshold 0
+--swiftversion 4.0
+--tabwidth unspecified
+--trailingclosures 
+--trimwhitespace always
+--typeattributes preserve
+--typemark "MARK: - %t"
+--varattributes preserve
+--voidtype void
+--wraparguments preserve
+--wrapcollections preserve
+--wrapconditions preserve
+--wrapparameters preserve
+--wrapreturntype preserve
+--xcodeindentation disabled
+--yodaswap always
+--disable initCoderUnavailable,redundantType