Browse Source

Update for Xcode 8 beta 2.

Jon Shier 9 years ago
parent
commit
fcb4829a78

+ 10 - 1
Alamofire.xcodeproj/project.pbxproj

@@ -795,7 +795,7 @@
 			isa = PBXProject;
 			attributes = {
 				LastSwiftUpdateCheck = 0700;
-				LastUpgradeCheck = 0700;
+				LastUpgradeCheck = 0800;
 				ORGANIZATIONNAME = Alamofire;
 				TargetAttributes = {
 					4CF626EE1BA7CB3E0011A099 = {
@@ -1214,6 +1214,7 @@
 				PRODUCT_NAME = Alamofire;
 				SDKROOT = appletvos;
 				SKIP_INSTALL = YES;
+				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 				TARGETED_DEVICE_FAMILY = 3;
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 			};
@@ -1248,6 +1249,7 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.Alamofire-tvOSTests";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = appletvos;
+				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 				TVOS_DEPLOYMENT_TARGET = 9.0;
 			};
 			name = Release;
@@ -1303,6 +1305,7 @@
 				PRODUCT_NAME = Alamofire;
 				SDKROOT = macosx;
 				SKIP_INSTALL = YES;
+				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 			};
 			name = Release;
 		};
@@ -1357,6 +1360,7 @@
 				PRODUCT_NAME = Alamofire;
 				SDKROOT = watchos;
 				SKIP_INSTALL = YES;
+				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 				TARGETED_DEVICE_FAMILY = 4;
 			};
 			name = Release;
@@ -1385,6 +1389,7 @@
 				ENABLE_TESTABILITY = YES;
 				GCC_C_LANGUAGE_STANDARD = gnu99;
 				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_NO_COMMON_BLOCKS = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PREPROCESSOR_DEFINITIONS = (
 					"DEBUG=1",
@@ -1434,6 +1439,7 @@
 				ENABLE_NS_ASSERTIONS = NO;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_NO_COMMON_BLOCKS = YES;
 				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
 				GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -1499,6 +1505,7 @@
 				PRODUCT_NAME = Alamofire;
 				SKIP_INSTALL = YES;
 				SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
+				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 				SWIFT_VERSION = 3.0;
 			};
 			name = Release;
@@ -1533,6 +1540,7 @@
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
+				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 				SWIFT_VERSION = 3.0;
 			};
 			name = Release;
@@ -1577,6 +1585,7 @@
 				PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.$(PRODUCT_NAME:rfc1034identifier)";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SDKROOT = macosx;
+				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 			};
 			name = Release;
 		};

+ 1 - 1
Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire OSX.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0700"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 1 - 1
Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire iOS.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0700"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 1 - 1
Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire tvOS.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0710"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 1 - 1
Alamofire.xcodeproj/xcshareddata/xcschemes/Alamofire watchOS.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0700"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 1 - 1
Example/iOS Example.xcodeproj/xcshareddata/xcschemes/iOS Example.xcscheme

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Scheme
-   LastUpgradeVersion = "0700"
+   LastUpgradeVersion = "0800"
    version = "1.3">
    <BuildAction
       parallelizeBuildables = "YES"

+ 2 - 2
Source/Download.swift

@@ -151,7 +151,7 @@ extension Request {
         -> DownloadFileDestination
     {
         return { temporaryURL, response -> URL in
-            let directoryURLs = FileManager.default().urlsForDirectory(directory, inDomains: domain)
+            let directoryURLs = FileManager.default.urlsForDirectory(directory, inDomains: domain)
 
             if !directoryURLs.isEmpty {
                 return try! directoryURLs[0].appendingPathComponent(response.suggestedFilename!)
@@ -199,7 +199,7 @@ extension Request {
             if let downloadTaskDidFinishDownloadingToURL = downloadTaskDidFinishDownloadingToURL {
                 do {
                     let destination = downloadTaskDidFinishDownloadingToURL(session, downloadTask, location)
-                    try FileManager.default().moveItem(at: location, to: destination)
+                    try FileManager.default.moveItem(at: location, to: destination)
                 } catch {
                     self.error = error as NSError
                 }

+ 6 - 6
Source/Manager.swift

@@ -36,7 +36,7 @@ public class Manager {
         for any ad hoc requests.
     */
     public static let sharedInstance: Manager = {
-        let configuration = URLSessionConfiguration.default()
+        let configuration = URLSessionConfiguration.default
         configuration.httpAdditionalHeaders = Manager.defaultHTTPHeaders
 
         return Manager(configuration: configuration)
@@ -50,14 +50,14 @@ public class Manager {
         let acceptEncoding: String = "gzip;q=1.0, compress;q=0.5"
 
         // Accept-Language HTTP Header; see https://tools.ietf.org/html/rfc7231#section-5.3.5
-        let acceptLanguage = Locale.preferredLanguages().prefix(6).enumerated().map { index, languageCode in
+        let acceptLanguage = Locale.preferredLanguages.prefix(6).enumerated().map { index, languageCode in
             let quality = 1.0 - (Double(index) * 0.1)
             return "\(languageCode);q=\(quality)"
         }.joined(separator: ", ")
 
         // User-Agent Header; see https://tools.ietf.org/html/rfc7231#section-5.5.3
         let userAgent: String = {
-            if let info = Bundle.main().infoDictionary {
+            if let info = Bundle.main.infoDictionary {
                 let executable = info[kCFBundleExecutableKey as String] as? String ?? "Unknown"
                 let bundle = info[kCFBundleIdentifierKey as String] as? String ?? "Unknown"
                 let version = info[kCFBundleVersionKey as String] as? String ?? "Unknown"
@@ -66,7 +66,7 @@ public class Manager {
                     let versionString: String
 
                     if #available(OSX 10.10, *) {
-                        let version = ProcessInfo.processInfo().operatingSystemVersion
+                        let version = ProcessInfo.processInfo.operatingSystemVersion
                         versionString = "\(version.majorVersion).\(version.minorVersion).\(version.patchVersion)"
                     } else {
                         versionString = "10.9"
@@ -143,7 +143,7 @@ public class Manager {
         - returns: The new `Manager` instance.
     */
     public init(
-        configuration: URLSessionConfiguration = URLSessionConfiguration.default(),
+        configuration: URLSessionConfiguration = URLSessionConfiguration.default,
         delegate: SessionDelegate = SessionDelegate(),
         serverTrustPolicyManager: ServerTrustPolicyManager? = nil)
     {
@@ -516,7 +516,7 @@ public class Manager {
                 delegate.urlSession(session, task: task, didCompleteWithError: error)
             }
 
-            NotificationCenter.default().post(name: Notification.Name(rawValue: Notifications.Task.DidComplete), object: task)
+            NotificationCenter.default.post(name: Notification.Name(rawValue: Notifications.Task.DidComplete), object: task)
 
             self[task] = nil
         }

+ 3 - 3
Source/MultipartFormData.swift

@@ -274,7 +274,7 @@ public class MultipartFormData {
 
         guard let
             path = fileURL.path
-            where FileManager.default().fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory else
+            where FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory else
         {
             let failureReason = "The file URL is a directory, not a file: \(fileURL)"
             setBodyPartError(code: NSURLErrorBadURL, failureReason: failureReason)
@@ -290,7 +290,7 @@ public class MultipartFormData {
         do {
             if let
                 path = fileURL.path,
-                fileSize = try FileManager.default().attributesOfItem(atPath: path)[FileAttributeKey.size.rawValue] as? NSNumber
+                fileSize = try FileManager.default.attributesOfItem(atPath: path)[.size] as? NSNumber
             {
                 bodyContentLength = fileSize.uint64Value
             }
@@ -409,7 +409,7 @@ public class MultipartFormData {
             throw bodyPartError
         }
 
-        if let path = fileURL.path where FileManager.default().fileExists(atPath: path) {
+        if let path = fileURL.path where FileManager.default.fileExists(atPath: path) {
             let failureReason = "A file already exists at the given file URL: \(fileURL)"
             throw Error.error(domain: NSURLErrorDomain, code: NSURLErrorBadURL, failureReason: failureReason)
         } else if !fileURL.isFileURL {

+ 3 - 3
Source/NetworkReachabilityManager.swift

@@ -154,12 +154,12 @@ public class NetworkReachabilityManager {
     @discardableResult
     public func startListening() -> Bool {
         var context = SCNetworkReachabilityContext(version: 0, info: nil, retain: nil, release: nil, copyDescription: nil)
-        context.info = UnsafeMutablePointer(OpaquePointer(bitPattern: Unmanaged.passUnretained(self)))
+        context.info = UnsafeMutablePointer(Unmanaged.passUnretained(self).toOpaque())
 
         let callbackEnabled = SCNetworkReachabilitySetCallback(
             reachability,
             { (_, flags, info) in
-                let reachability = Unmanaged<NetworkReachabilityManager>.fromOpaque(OpaquePointer(info!)).takeUnretainedValue()
+                let reachability = Unmanaged<NetworkReachabilityManager>.fromOpaque(info!).takeUnretainedValue()
                 reachability.notifyListener(flags)
             },
             &context
@@ -206,7 +206,7 @@ public class NetworkReachabilityManager {
         }
 
         #if os(iOS)
-            if flags.contains(.iswwan) { networkStatus = .reachable(.wwan) }
+            if flags.contains(.isWWAN) { networkStatus = .reachable(.wwan) }
         #endif
 
         return networkStatus

+ 1 - 1
Source/ParameterEncoding.swift

@@ -223,7 +223,7 @@ public enum ParameterEncoding {
 
         // rdar://26850776
         // Crash in Xcode 8 Seed 1 when trying to mutate a CharacterSet with remove
-        var allowedCharacterSet = NSMutableCharacterSet.urlQueryAllowed()
+        var allowedCharacterSet = NSMutableCharacterSet.urlQueryAllowed
         allowedCharacterSet.remove(charactersIn: "\(generalDelimitersToEncode)\(subDelimitersToEncode)")
 
         var escaped = ""

+ 4 - 4
Source/Request.swift

@@ -118,7 +118,7 @@ public class Request {
     public static func authorizationHeader(user: String, password: String) -> [String: String] {
         guard let data = "\(user):\(password)".data(using: String.Encoding.utf8) else { return [:] }
 
-        let credential = data.base64EncodedString([])
+        let credential = data.base64EncodedString(options: [])
 
         return ["Authorization": "Basic \(credential)"]
     }
@@ -180,7 +180,7 @@ public class Request {
         if startTime == nil { startTime = CFAbsoluteTimeGetCurrent() }
 
         task.resume()
-        NotificationCenter.default().post(name: Notification.Name(rawValue: Notifications.Task.DidResume), object: task)
+        NotificationCenter.default.post(name: Notification.Name(rawValue: Notifications.Task.DidResume), object: task)
     }
 
     /**
@@ -188,7 +188,7 @@ public class Request {
     */
     public func suspend() {
         task.suspend()
-        NotificationCenter.default().post(name: Notification.Name(rawValue: Notifications.Task.DidSuspend), object: task)
+        NotificationCenter.default.post(name: Notification.Name(rawValue: Notifications.Task.DidSuspend), object: task)
     }
 
     /**
@@ -206,7 +206,7 @@ public class Request {
             task.cancel()
         }
 
-        NotificationCenter.default().post(name: Notification.Name(rawValue: Notifications.Task.DidCancel), object: task)
+        NotificationCenter.default.post(name: Notification.Name(rawValue: Notifications.Task.DidCancel), object: task)
     }
 
     // MARK: - TaskDelegate

+ 5 - 5
Source/ServerTrustPolicy.swift

@@ -127,7 +127,7 @@ public enum ServerTrustPolicy {
 
         - returns: All certificates within the given bundle.
     */
-    public static func certificatesInBundle(_ bundle: Bundle = Bundle.main()) -> [SecCertificate] {
+    public static func certificatesInBundle(_ bundle: Bundle = Bundle.main) -> [SecCertificate] {
         var certificates: [SecCertificate] = []
 
         let paths = Set([".cer", ".CER", ".crt", ".CRT", ".der", ".DER"].map { fileExtension in
@@ -153,7 +153,7 @@ public enum ServerTrustPolicy {
 
         - returns: All public keys within the given bundle.
     */
-    public static func publicKeysInBundle(_ bundle: Bundle = Bundle.main()) -> [SecKey] {
+    public static func publicKeysInBundle(_ bundle: Bundle = Bundle.main) -> [SecKey] {
         var publicKeys: [SecKey] = []
 
         for certificate in certificatesInBundle(bundle) {
@@ -181,13 +181,13 @@ public enum ServerTrustPolicy {
         switch self {
         case let .performDefaultEvaluation(validateHost):
             let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil)
-            SecTrustSetPolicies(serverTrust, [policy!] )
+            SecTrustSetPolicies(serverTrust, [policy])
 
             serverTrustIsValid = trustIsValid(serverTrust)
         case let .pinCertificates(pinnedCertificates, validateCertificateChain, validateHost):
             if validateCertificateChain {
                 let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil)
-                SecTrustSetPolicies(serverTrust, [policy!])
+                SecTrustSetPolicies(serverTrust, [policy])
 
                 SecTrustSetAnchorCertificates(serverTrust, pinnedCertificates)
                 SecTrustSetAnchorCertificatesOnly(serverTrust, true)
@@ -211,7 +211,7 @@ public enum ServerTrustPolicy {
 
             if validateCertificateChain {
                 let policy = SecPolicyCreateSSL(true, validateHost ? host as CFString : nil)
-                SecTrustSetPolicies(serverTrust, [policy!])
+                SecTrustSetPolicies(serverTrust, [policy])
 
                 certificateChainEvaluationPassed = trustIsValid(serverTrust)
             }

+ 1 - 1
Source/Upload.swift

@@ -315,7 +315,7 @@ extension Manager {
                     }
                 }
             } else {
-                let fileManager = FileManager.default()
+                let fileManager = FileManager.default
                 let tempDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory())
                 let directoryURL = try! tempDirectoryURL.appendingPathComponent("com.alamofire.manager/multipart.form.data")
                 let fileName = UUID().uuidString

+ 3 - 3
Tests/AuthenticationTests.swift

@@ -36,10 +36,10 @@ class AuthenticationTestCase: BaseTestCase {
     override func setUp() {
         super.setUp()
 
-        manager = Manager(configuration: URLSessionConfiguration.default())
+        manager = Manager(configuration: .default)
 
         // Clear out credentials
-        let credentialStorage = URLCredentialStorage.shared()
+        let credentialStorage = URLCredentialStorage.shared
 
         for (protectionSpace, credentials) in credentialStorage.allCredentials {
             for (_, credential) in credentials {
@@ -48,7 +48,7 @@ class AuthenticationTestCase: BaseTestCase {
         }
 
         // Clear out cookies
-        let cookieStorage = HTTPCookieStorage.shared()
+        let cookieStorage = HTTPCookieStorage.shared
         cookieStorage.cookies?.forEach { cookieStorage.deleteCookie($0) }
     }
 }

+ 1 - 1
Tests/CacheTests.swift

@@ -95,7 +95,7 @@ class CacheTestCase: BaseTestCase {
 
         manager = {
             let configuration: URLSessionConfiguration = {
-                let configuration = URLSessionConfiguration.default()
+                let configuration = URLSessionConfiguration.default
                 configuration.httpAdditionalHeaders = Alamofire.Manager.defaultHTTPHeaders
                 configuration.requestCachePolicy = .useProtocolCachePolicy
                 configuration.urlCache = URLCache

+ 2 - 2
Tests/DownloadTests.swift

@@ -115,7 +115,7 @@ class DownloadResponseTestCase: BaseTestCase {
         XCTAssertNotNil(response, "response should not be nil")
         XCTAssertNil(error, "error should be nil")
 
-        let fileManager = FileManager.default()
+        let fileManager = FileManager.default
         let directory = fileManager.urlsForDirectory(searchPathDirectory, inDomains: self.searchPathDomain)[0]
 
         do {
@@ -166,7 +166,7 @@ class DownloadResponseTestCase: BaseTestCase {
         let randomBytes = 4 * 1024 * 1024
         let urlString = "https://httpbin.org/bytes/\(randomBytes)"
 
-        let fileManager = FileManager.default()
+        let fileManager = FileManager.default
         let directory = fileManager.urlsForDirectory(searchPathDirectory, inDomains: self.searchPathDomain)[0]
         let filename = "test_download_data"
         let fileURL = try! directory.appendingPathComponent(filename)

+ 8 - 8
Tests/ManagerTests.swift

@@ -42,7 +42,7 @@ class ManagerTestCase: BaseTestCase {
 
     func testInitializerWithSpecifiedArguments() {
         // Given
-        let configuration = URLSessionConfiguration.default()
+        let configuration = URLSessionConfiguration.default
         let delegate = Manager.SessionDelegate()
         let serverTrustPolicyManager = ServerTrustPolicyManager(policies: [:])
 
@@ -63,7 +63,7 @@ class ManagerTestCase: BaseTestCase {
         // Given
         let delegate = Manager.SessionDelegate()
         let session: URLSession = {
-            let configuration = URLSessionConfiguration.default()
+            let configuration = URLSessionConfiguration.default
             return URLSession(configuration: configuration, delegate: delegate, delegateQueue: nil)
         }()
 
@@ -83,7 +83,7 @@ class ManagerTestCase: BaseTestCase {
         // Given
         let delegate = Manager.SessionDelegate()
         let session: URLSession = {
-            let configuration = URLSessionConfiguration.default()
+            let configuration = URLSessionConfiguration.default
             return URLSession(configuration: configuration, delegate: delegate, delegateQueue: nil)
         }()
 
@@ -105,7 +105,7 @@ class ManagerTestCase: BaseTestCase {
         // Given
         let delegate = Manager.SessionDelegate()
         let session: URLSession = {
-            let configuration = URLSessionConfiguration.default()
+            let configuration = URLSessionConfiguration.default
             return URLSession(configuration: configuration, delegate: Manager.SessionDelegate(), delegateQueue: nil)
         }()
 
@@ -120,7 +120,7 @@ class ManagerTestCase: BaseTestCase {
         // Given
         let delegate = Manager.SessionDelegate()
         let session: URLSession = {
-            let configuration = URLSessionConfiguration.default()
+            let configuration = URLSessionConfiguration.default
             return URLSession(configuration: configuration, delegate: nil, delegateQueue: nil)
         }()
 
@@ -231,12 +231,12 @@ class ManagerConfigurationHeadersTestCase: BaseTestCase {
 
                 switch type {
                 case .default:
-                    configuration = URLSessionConfiguration.default()
+                    configuration = .default
                 case .ephemeral:
-                    configuration = URLSessionConfiguration.ephemeral()
+                    configuration = .ephemeral
                 case .background:
                     let identifier = "com.alamofire.test.manager-configuration-tests"
-                    configuration = URLSessionConfiguration.backgroundSessionConfigurationForAllPlatformsWithIdentifier(identifier)
+                    configuration = .backgroundSessionConfigurationForAllPlatformsWithIdentifier(identifier)
                 }
 
                 var headers = Alamofire.Manager.defaultHTTPHeaders

+ 1 - 1
Tests/MultipartFormDataTests.swift

@@ -62,7 +62,7 @@ private func temporaryFileURL() -> URL {
     let tempDirectoryURL = URL(fileURLWithPath: NSTemporaryDirectory())
     let directoryURL = try! tempDirectoryURL.appendingPathComponent("com.alamofire.test/multipart.form.data")
 
-    let fileManager = FileManager.default()
+    let fileManager = FileManager.default
     do {
         try fileManager.createDirectory(at: directoryURL, withIntermediateDirectories: true, attributes: nil)
     } catch {

+ 1 - 1
Tests/NetworkReachabilityManagerTests.swift

@@ -214,7 +214,7 @@ class NetworkReachabilityManagerTestCase: BaseTestCase {
     func testThatManagerReturnsReachableOnWWANStatusWhenIsWWAN() {
         // Given
         let manager = NetworkReachabilityManager()
-        let flags: SCNetworkReachabilityFlags = [.reachable, .iswwan]
+        let flags: SCNetworkReachabilityFlags = [.reachable, .isWWAN]
 
         // When
         let networkReachabilityStatus = manager?.networkReachabilityStatusForFlags(flags)

+ 1 - 1
Tests/ParameterEncodingTests.swift

@@ -524,7 +524,7 @@ class JSONParameterEncodingTestCase: ParameterEncodingTestCase {
 class PropertyListParameterEncodingTestCase: ParameterEncodingTestCase {
     // MARK: Properties
 
-    let encoding: ParameterEncoding = .propertyList(.xmlFormat_v1_0, 0)
+    let encoding: ParameterEncoding = .propertyList(.xml, 0)
 
     // MARK: Tests
 

+ 6 - 6
Tests/RequestTests.swift

@@ -333,14 +333,14 @@ class RequestResponseTestCase: BaseTestCase {
             let URL = URLForResource("unicorn", withExtension: "png")
             let data = try! Data(contentsOf: URL)
 
-            return data.base64EncodedString(.encoding64CharacterLineLength)
+            return data.base64EncodedString(options: .lineLength64Characters)
         }()
 
         let jpegBase64EncodedString: String = {
             let URL = URLForResource("rainbow", withExtension: "jpg")
             let data = try! Data(contentsOf: URL)
 
-            return data.base64EncodedString(.encoding64CharacterLineLength)
+            return data.base64EncodedString(options: .lineLength64Characters)
         }()
 
         let parameters = [
@@ -482,7 +482,7 @@ class RequestDebugDescriptionTestCase: BaseTestCase {
     // MARK: Properties
 
     let manager: Manager = {
-        let manager = Manager(configuration: URLSessionConfiguration.default())
+        let manager = Manager(configuration: .default)
         manager.startRequestsImmediately = false
         return manager
     }()
@@ -491,7 +491,7 @@ class RequestDebugDescriptionTestCase: BaseTestCase {
         var headers = Alamofire.Manager.sharedInstance.session.configuration.httpAdditionalHeaders ?? [:]
         headers["Accept-Language"] = "en-US"
         
-        let configuration = URLSessionConfiguration.default()
+        let configuration = URLSessionConfiguration.default
         configuration.httpAdditionalHeaders = headers
         
         let manager = Manager(configuration: configuration)
@@ -503,7 +503,7 @@ class RequestDebugDescriptionTestCase: BaseTestCase {
         var headers = Alamofire.Manager.sharedInstance.session.configuration.httpAdditionalHeaders ?? [:]
         headers["Content-Type"] = "application/json"
 
-        let configuration = URLSessionConfiguration.default()
+        let configuration = URLSessionConfiguration.default
         configuration.httpAdditionalHeaders = headers
 
         let manager = Manager(configuration: configuration)
@@ -512,7 +512,7 @@ class RequestDebugDescriptionTestCase: BaseTestCase {
     }()
 
     let managerDisallowingCookies: Manager = {
-        let configuration = URLSessionConfiguration.default()
+        let configuration = URLSessionConfiguration.default
         configuration.httpShouldSetCookies = false
 
         let manager = Manager(configuration: configuration)

+ 15 - 15
Tests/ServerTrustPolicyTests.swift

@@ -233,7 +233,7 @@ class ServerTrustPolicyExplorationBasicX509PolicyValidationTestCase: ServerTrust
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateBasicX509()!]
+        let policies = [SecPolicyCreateBasicX509()]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -246,7 +246,7 @@ class ServerTrustPolicyExplorationBasicX509PolicyValidationTestCase: ServerTrust
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateBasicX509()!]
+        let policies = [SecPolicyCreateBasicX509()]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -259,7 +259,7 @@ class ServerTrustPolicyExplorationBasicX509PolicyValidationTestCase: ServerTrust
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateBasicX509()!]
+        let policies = [SecPolicyCreateBasicX509()]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -272,7 +272,7 @@ class ServerTrustPolicyExplorationBasicX509PolicyValidationTestCase: ServerTrust
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateBasicX509()!]
+        let policies = [SecPolicyCreateBasicX509()]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -294,7 +294,7 @@ class ServerTrustPolicyExplorationSSLPolicyValidationTestCase: ServerTrustPolicy
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")!]
+        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -307,7 +307,7 @@ class ServerTrustPolicyExplorationSSLPolicyValidationTestCase: ServerTrustPolicy
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")!]
+        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -320,7 +320,7 @@ class ServerTrustPolicyExplorationSSLPolicyValidationTestCase: ServerTrustPolicy
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")!]
+        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -333,7 +333,7 @@ class ServerTrustPolicyExplorationSSLPolicyValidationTestCase: ServerTrustPolicy
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")!]
+        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -346,7 +346,7 @@ class ServerTrustPolicyExplorationSSLPolicyValidationTestCase: ServerTrustPolicy
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")!]
+        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -359,7 +359,7 @@ class ServerTrustPolicyExplorationSSLPolicyValidationTestCase: ServerTrustPolicy
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")!]
+        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -373,9 +373,9 @@ class ServerTrustPolicyExplorationSSLPolicyValidationTestCase: ServerTrustPolicy
 
         // When
         let policies = [
-            SecPolicyCreateSSL(true, "test.alamofire.org")!,
-            SecPolicyCreateSSL(true, "blog.alamofire.org")!,
-            SecPolicyCreateSSL(true, "www.alamofire.org")!
+            SecPolicyCreateSSL(true, "test.alamofire.org"),
+            SecPolicyCreateSSL(true, "blog.alamofire.org"),
+            SecPolicyCreateSSL(true, "www.alamofire.org")
         ]
         SecTrustSetPolicies(trust, policies)
 
@@ -389,7 +389,7 @@ class ServerTrustPolicyExplorationSSLPolicyValidationTestCase: ServerTrustPolicy
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateSSL(true, nil)!]
+        let policies = [SecPolicyCreateSSL(true, nil)]
         SecTrustSetPolicies(trust, policies)
 
         // Then
@@ -402,7 +402,7 @@ class ServerTrustPolicyExplorationSSLPolicyValidationTestCase: ServerTrustPolicy
         setRootCertificateAsLoneAnchorCertificateForTrust(trust)
 
         // When
-        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")!]
+        let policies = [SecPolicyCreateSSL(true, "test.alamofire.org")]
         SecTrustSetPolicies(trust, policies)
 
         // Then

+ 1 - 1
Tests/SessionDelegateTests.swift

@@ -33,7 +33,7 @@ class SessionDelegateTestCase: BaseTestCase {
 
     override func setUp() {
         super.setUp()
-        manager = Alamofire.Manager(configuration: URLSessionConfiguration.ephemeral())
+        manager = Alamofire.Manager(configuration: .ephemeral)
     }
 
     // MARK: - Tests - Session Invalidation

+ 1 - 1
Tests/TLSEvaluationTests.swift

@@ -70,7 +70,7 @@ class TLSEvaluationExpiredLeafCertificateTestCase: BaseTestCase {
 
     override func setUp() {
         super.setUp()
-        configuration = URLSessionConfiguration.ephemeral()
+        configuration = URLSessionConfiguration.ephemeral
     }
 
     // MARK: Default Behavior Tests

+ 2 - 2
Tests/URLProtocolTests.swift

@@ -36,7 +36,7 @@ class ProxyURLProtocol: URLProtocol {
 
     lazy var session: Foundation.URLSession = {
         let configuration: URLSessionConfiguration = {
-            let configuration = URLSessionConfiguration.ephemeral()
+            let configuration = URLSessionConfiguration.ephemeral
             configuration.httpAdditionalHeaders = Alamofire.Manager.defaultHTTPHeaders
 
             return configuration
@@ -119,7 +119,7 @@ class URLProtocolTestCase: BaseTestCase {
 
         manager = {
             let configuration: URLSessionConfiguration = {
-                let configuration = URLSessionConfiguration.default()
+                let configuration = URLSessionConfiguration.default
                 configuration.protocolClasses = [ProxyURLProtocol.self]
                 configuration.httpAdditionalHeaders = ["session-configuration-header": "foo"]
 

+ 1 - 1
Tests/UploadTests.swift

@@ -524,7 +524,7 @@ class UploadMultipartFormDataTestCase: BaseTestCase {
         {
             XCTAssertTrue(streamingFromDisk, "streaming from disk should be true")
             XCTAssertTrue(
-                FileManager.default().fileExists(atPath: streamFilePath),
+                FileManager.default.fileExists(atPath: streamFilePath),
                 "stream file path should exist"
             )
         }

+ 1 - 1
Tests/ValidationTests.swift

@@ -273,7 +273,7 @@ class ContentTypeValidationTestCase: BaseTestCase {
 
         let manager: Manager = {
             let configuration: URLSessionConfiguration = {
-                let configuration = URLSessionConfiguration.ephemeral()
+                let configuration = URLSessionConfiguration.ephemeral
                 configuration.httpAdditionalHeaders = Alamofire.Manager.defaultHTTPHeaders
 
                 return configuration