Browse Source

Fix for Swift 4.

Jon Shier 8 years ago
parent
commit
c31cacd53b

+ 0 - 2
Source/Mutex+Protector.swift

@@ -76,7 +76,6 @@ final class Mutex: Lock {
         let result = pthread_mutex_unlock(&mutex)
         assert(result == 0, "Failed to unlock mutex")
     }
-}
 
 // MARK: -
     ///
@@ -109,7 +108,6 @@ final class UnfairLock: Lock {
 
     fileprivate func unlock() {
         os_unfair_lock_unlock(&unfairLock)
-}
     }
 
 // MARK: -

+ 2 - 2
Source/ResponseSerialization.swift

@@ -50,7 +50,7 @@ public typealias ResponseSerializer = DataResponseSerializerProtocol & DownloadR
 /// 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.
 public extension DownloadResponseSerializerProtocol where Self: DataResponseSerializerProtocol {
-    public func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> SerializedObject {
+    public func serializeDownload(request: URLRequest?, response: HTTPURLResponse?, fileURL: URL?, error: Error?) throws -> Self.SerializedObject {
         guard error == nil else { throw error! }
 
         guard let fileURL = fileURL else {
@@ -385,7 +385,7 @@ public final class StringResponseSerializer: ResponseSerializer {
 
         var convertedEncoding = encoding
 
-        if let encodingName = response?.textEncodingName as CFString!, convertedEncoding == nil {
+        if let encodingName = response?.textEncodingName as CFString?, convertedEncoding == nil {
             let ianaCharSet = CFStringConvertIANACharSetNameToEncoding(encodingName)
             let nsStringEncoding = CFStringConvertEncodingToNSStringEncoding(ianaCharSet)
             convertedEncoding = String.Encoding(rawValue: nsStringEncoding)

+ 2 - 2
Tests/SessionDelegateTests.swift

@@ -512,7 +512,7 @@ class SessionDelegateTestCase: BaseTestCase {
         var notificationCalledWithResponseData = false
         var response: HTTPURLResponse?
 
-        let expectation = self.expectation(forNotification: Notification.Name.Task.DidComplete.rawValue, object: nil) { notif -> Bool in
+        let expectation = self.expectation(forNotification: Notification.Name.Task.DidComplete, object: nil) { notif -> Bool in
 
             // check that we are handling notif for a dataTask
             guard let task = notif.userInfo?[Notification.Key.Task] as? URLSessionDataTask else {
@@ -544,7 +544,7 @@ class SessionDelegateTestCase: BaseTestCase {
         var notificationCalledWithNilResponseData = false
         var response: HTTPURLResponse?
 
-        let expectation = self.expectation(forNotification: Notification.Name.Task.DidComplete.rawValue, object: nil) { notif -> Bool in
+        let expectation = self.expectation(forNotification: Notification.Name.Task.DidComplete, object: nil) { notif -> Bool in
 
             // check that we are handling notif for a downloadTask
             guard let task = notif.userInfo?[Notification.Key.Task] as? URLSessionDownloadTask else {