Przeglądaj źródła

Merge pull request #1690 from onevcat/fix/swift-5.1

Fix Swift 5.1
Wei Wang 4 lat temu
rodzic
commit
543cb4cb6c

+ 1 - 1
.github/workflows/build.yaml

@@ -13,7 +13,7 @@ jobs:
           'tvOS Simulator,name=Apple TV', 
           'tvOS Simulator,name=Apple TV', 
           'watchOS Simulator,name=Apple Watch Series 5 - 40mm'
           'watchOS Simulator,name=Apple Watch Series 5 - 40mm'
         ]
         ]
-        swift-version: [5.0, 4.2, 4.0]
+        swift-version: [5.0]
     steps:
     steps:
       - uses: actions/checkout@v1
       - uses: actions/checkout@v1
       - uses: actions/cache@v1
       - uses: actions/cache@v1

+ 1 - 1
Demo/Kingfisher-Demo.xcodeproj/project.pbxproj

@@ -519,7 +519,7 @@
 			isa = PBXProject;
 			isa = PBXProject;
 			attributes = {
 			attributes = {
 				LastSwiftUpdateCheck = 1100;
 				LastSwiftUpdateCheck = 1100;
-				LastUpgradeCheck = 1230;
+				LastUpgradeCheck = 1240;
 				ORGANIZATIONNAME = "Wei Wang";
 				ORGANIZATIONNAME = "Wei Wang";
 				TargetAttributes = {
 				TargetAttributes = {
 					4B2944541C3D03880088C3E7 = {
 					4B2944541C3D03880088C3E7 = {

+ 28 - 24
Gemfile.lock

@@ -2,7 +2,7 @@ GEM
   remote: https://rubygems.org/
   remote: https://rubygems.org/
   specs:
   specs:
     CFPropertyList (3.0.3)
     CFPropertyList (3.0.3)
-    activesupport (5.2.4.5)
+    activesupport (5.2.5)
       concurrent-ruby (~> 1.0, >= 1.0.2)
       concurrent-ruby (~> 1.0, >= 1.0.2)
       i18n (>= 0.7, < 2)
       i18n (>= 0.7, < 2)
       minitest (~> 5.1)
       minitest (~> 5.1)
@@ -15,16 +15,16 @@ GEM
     artifactory (3.0.15)
     artifactory (3.0.15)
     atomos (0.1.3)
     atomos (0.1.3)
     aws-eventstream (1.1.1)
     aws-eventstream (1.1.1)
-    aws-partitions (1.431.1)
-    aws-sdk-core (3.112.1)
+    aws-partitions (1.446.0)
+    aws-sdk-core (3.114.0)
       aws-eventstream (~> 1, >= 1.0.2)
       aws-eventstream (~> 1, >= 1.0.2)
       aws-partitions (~> 1, >= 1.239.0)
       aws-partitions (~> 1, >= 1.239.0)
       aws-sigv4 (~> 1.1)
       aws-sigv4 (~> 1.1)
       jmespath (~> 1.0)
       jmespath (~> 1.0)
-    aws-sdk-kms (1.42.0)
+    aws-sdk-kms (1.43.0)
       aws-sdk-core (~> 3, >= 3.112.0)
       aws-sdk-core (~> 3, >= 3.112.0)
       aws-sigv4 (~> 1.1)
       aws-sigv4 (~> 1.1)
-    aws-sdk-s3 (1.89.0)
+    aws-sdk-s3 (1.93.1)
       aws-sdk-core (~> 3, >= 3.112.0)
       aws-sdk-core (~> 3, >= 3.112.0)
       aws-sdk-kms (~> 1)
       aws-sdk-kms (~> 1)
       aws-sigv4 (~> 1.1)
       aws-sigv4 (~> 1.1)
@@ -75,7 +75,6 @@ GEM
       highline (~> 1.7.2)
       highline (~> 1.7.2)
     concurrent-ruby (1.1.8)
     concurrent-ruby (1.1.8)
     declarative (0.0.20)
     declarative (0.0.20)
-    declarative-option (0.1.0)
     digest-crc (0.6.3)
     digest-crc (0.6.3)
       rake (>= 12.0.0, < 14.0.0)
       rake (>= 12.0.0, < 14.0.0)
     domain_name (0.5.20190701)
     domain_name (0.5.20190701)
@@ -83,21 +82,25 @@ GEM
     dotenv (2.7.6)
     dotenv (2.7.6)
     emoji_regex (3.2.2)
     emoji_regex (3.2.2)
     escape (0.0.4)
     escape (0.0.4)
-    ethon (0.12.0)
-      ffi (>= 1.3.0)
-    excon (0.79.0)
-    faraday (1.3.0)
+    ethon (0.13.0)
+      ffi (>= 1.15.0)
+    excon (0.80.1)
+    faraday (1.4.1)
+      faraday-excon (~> 1.1)
       faraday-net_http (~> 1.0)
       faraday-net_http (~> 1.0)
+      faraday-net_http_persistent (~> 1.1)
       multipart-post (>= 1.2, < 3)
       multipart-post (>= 1.2, < 3)
-      ruby2_keywords
+      ruby2_keywords (>= 0.0.4)
     faraday-cookie_jar (0.0.7)
     faraday-cookie_jar (0.0.7)
       faraday (>= 0.8.0)
       faraday (>= 0.8.0)
       http-cookie (~> 1.0.0)
       http-cookie (~> 1.0.0)
+    faraday-excon (1.1.0)
     faraday-net_http (1.0.1)
     faraday-net_http (1.0.1)
+    faraday-net_http_persistent (1.1.0)
     faraday_middleware (1.0.0)
     faraday_middleware (1.0.0)
       faraday (~> 1.0)
       faraday (~> 1.0)
     fastimage (2.2.3)
     fastimage (2.2.3)
-    fastlane (2.176.0)
+    fastlane (2.181.0)
       CFPropertyList (>= 2.3, < 4.0.0)
       CFPropertyList (>= 2.3, < 4.0.0)
       addressable (>= 2.3, < 3.0.0)
       addressable (>= 2.3, < 3.0.0)
       artifactory (~> 3.0)
       artifactory (~> 3.0)
@@ -157,17 +160,17 @@ GEM
       rexml
       rexml
       signet (~> 0.14)
       signet (~> 0.14)
       webrick
       webrick
-    google-apis-iamcredentials_v1 (0.2.0)
+    google-apis-iamcredentials_v1 (0.3.0)
       google-apis-core (~> 0.1)
       google-apis-core (~> 0.1)
     google-apis-storage_v1 (0.3.0)
     google-apis-storage_v1 (0.3.0)
       google-apis-core (~> 0.1)
       google-apis-core (~> 0.1)
-    google-cloud-core (1.5.0)
+    google-cloud-core (1.6.0)
       google-cloud-env (~> 1.0)
       google-cloud-env (~> 1.0)
       google-cloud-errors (~> 1.0)
       google-cloud-errors (~> 1.0)
-    google-cloud-env (1.4.0)
+    google-cloud-env (1.5.0)
       faraday (>= 0.17.3, < 2.0)
       faraday (>= 0.17.3, < 2.0)
-    google-cloud-errors (1.0.1)
-    google-cloud-storage (1.30.0)
+    google-cloud-errors (1.1.0)
+    google-cloud-storage (1.31.0)
       addressable (~> 2.5)
       addressable (~> 2.5)
       digest-crc (~> 0.4)
       digest-crc (~> 0.4)
       google-apis-iamcredentials_v1 (~> 0.1)
       google-apis-iamcredentials_v1 (~> 0.1)
@@ -175,7 +178,7 @@ GEM
       google-cloud-core (~> 1.2)
       google-cloud-core (~> 1.2)
       googleauth (~> 0.9)
       googleauth (~> 0.9)
       mini_mime (~> 1.0)
       mini_mime (~> 1.0)
-    googleauth (0.16.0)
+    googleauth (0.16.1)
       faraday (>= 0.17.3, < 2.0)
       faraday (>= 0.17.3, < 2.0)
       jwt (>= 1.4, < 3.0)
       jwt (>= 1.4, < 3.0)
       memoist (~> 0.16)
       memoist (~> 0.16)
@@ -186,14 +189,14 @@ GEM
     http-cookie (1.0.3)
     http-cookie (1.0.3)
       domain_name (~> 0.5)
       domain_name (~> 0.5)
     httpclient (2.8.3)
     httpclient (2.8.3)
-    i18n (1.8.9)
+    i18n (1.8.10)
       concurrent-ruby (~> 1.0)
       concurrent-ruby (~> 1.0)
     jmespath (1.4.0)
     jmespath (1.4.0)
     json (2.5.1)
     json (2.5.1)
-    jwt (2.2.2)
+    jwt (2.2.3)
     memoist (0.16.2)
     memoist (0.16.2)
     mini_magick (4.11.0)
     mini_magick (4.11.0)
-    mini_mime (1.0.2)
+    mini_mime (1.1.0)
     minitest (5.14.4)
     minitest (5.14.4)
     molinillo (0.6.6)
     molinillo (0.6.6)
     multi_json (1.15.0)
     multi_json (1.15.0)
@@ -206,12 +209,12 @@ GEM
     plist (3.6.0)
     plist (3.6.0)
     public_suffix (4.0.6)
     public_suffix (4.0.6)
     rake (13.0.3)
     rake (13.0.3)
-    representable (3.0.4)
+    representable (3.1.1)
       declarative (< 0.1.0)
       declarative (< 0.1.0)
-      declarative-option (< 0.2.0)
+      trailblazer-option (>= 0.1.1, < 0.2.0)
       uber (< 0.2.0)
       uber (< 0.2.0)
     retriable (3.1.2)
     retriable (3.1.2)
-    rexml (3.2.4)
+    rexml (3.2.5)
     rouge (2.0.7)
     rouge (2.0.7)
     ruby-macho (1.4.0)
     ruby-macho (1.4.0)
     ruby2_keywords (0.0.4)
     ruby2_keywords (0.0.4)
@@ -230,6 +233,7 @@ GEM
     terminal-table (1.8.0)
     terminal-table (1.8.0)
       unicode-display_width (~> 1.1, >= 1.1.1)
       unicode-display_width (~> 1.1, >= 1.1.1)
     thread_safe (0.3.6)
     thread_safe (0.3.6)
+    trailblazer-option (0.1.1)
     tty-cursor (0.7.1)
     tty-cursor (0.7.1)
     tty-screen (0.8.1)
     tty-screen (0.8.1)
     tty-spinner (0.9.3)
     tty-spinner (0.9.3)

+ 1 - 2
Kingfisher.podspec

@@ -25,8 +25,7 @@ Pod::Spec.new do |s|
   s.authors            = { "onevcat" => "onevcat@gmail.com" }
   s.authors            = { "onevcat" => "onevcat@gmail.com" }
   s.social_media_url   = "https://github.com/onevcat"
   s.social_media_url   = "https://github.com/onevcat"
 
 
-  s.swift_version = "5.0"
-  s.swift_versions = ['4.0', '4.2', '5.0']
+  s.swift_versions = ['5.0']
 
 
   s.ios.deployment_target = "10.0"
   s.ios.deployment_target = "10.0"
   s.tvos.deployment_target = "10.0"
   s.tvos.deployment_target = "10.0"

+ 1 - 1
Kingfisher.xcodeproj/project.pbxproj

@@ -723,7 +723,7 @@
 			isa = PBXProject;
 			isa = PBXProject;
 			attributes = {
 			attributes = {
 				LastSwiftUpdateCheck = 0720;
 				LastSwiftUpdateCheck = 0720;
-				LastUpgradeCheck = 1230;
+				LastUpgradeCheck = 1240;
 				ORGANIZATIONNAME = "Wei Wang";
 				ORGANIZATIONNAME = "Wei Wang";
 				TargetAttributes = {
 				TargetAttributes = {
 					D1ED2D341AD2D09F00CFC3EB = {
 					D1ED2D341AD2D09F00CFC3EB = {

+ 1 - 1
Kingfisher.xcodeproj/xcshareddata/xcschemes/Kingfisher.xcscheme

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

+ 0 - 12
Sources/Cache/ImageCache.swift

@@ -182,19 +182,11 @@ open class ImageCache {
 
 
         let notifications: [(Notification.Name, Selector)]
         let notifications: [(Notification.Name, Selector)]
         #if !os(macOS) && !os(watchOS)
         #if !os(macOS) && !os(watchOS)
-        #if swift(>=4.2)
         notifications = [
         notifications = [
             (UIApplication.didReceiveMemoryWarningNotification, #selector(clearMemoryCache)),
             (UIApplication.didReceiveMemoryWarningNotification, #selector(clearMemoryCache)),
             (UIApplication.willTerminateNotification, #selector(cleanExpiredDiskCache)),
             (UIApplication.willTerminateNotification, #selector(cleanExpiredDiskCache)),
             (UIApplication.didEnterBackgroundNotification, #selector(backgroundCleanExpiredDiskCache))
             (UIApplication.didEnterBackgroundNotification, #selector(backgroundCleanExpiredDiskCache))
         ]
         ]
-        #else
-        notifications = [
-            (NSNotification.Name.UIApplicationDidReceiveMemoryWarning, #selector(clearMemoryCache)),
-            (NSNotification.Name.UIApplicationWillTerminate, #selector(cleanExpiredDiskCache)),
-            (NSNotification.Name.UIApplicationDidEnterBackground, #selector(backgroundCleanExpiredDiskCache))
-        ]
-        #endif
         #elseif os(macOS)
         #elseif os(macOS)
         notifications = [
         notifications = [
             (NSApplication.willResignActiveNotification, #selector(cleanExpiredDiskCache)),
             (NSApplication.willResignActiveNotification, #selector(cleanExpiredDiskCache)),
@@ -708,11 +700,7 @@ open class ImageCache {
 
 
         func endBackgroundTask(_ task: inout UIBackgroundTaskIdentifier) {
         func endBackgroundTask(_ task: inout UIBackgroundTaskIdentifier) {
             sharedApplication.endBackgroundTask(task)
             sharedApplication.endBackgroundTask(task)
-            #if swift(>=4.2)
             task = UIBackgroundTaskIdentifier.invalid
             task = UIBackgroundTaskIdentifier.invalid
-            #else
-            task = UIBackgroundTaskInvalid
-            #endif
         }
         }
         
         
         var backgroundTask: UIBackgroundTaskIdentifier!
         var backgroundTask: UIBackgroundTaskIdentifier!

+ 0 - 8
Sources/Image/Image.swift

@@ -201,11 +201,7 @@ extension KingfisherWrapper where Base: KFCrossPlatformImage {
             let rep = NSBitmapImageRep(cgImage: cgImage)
             let rep = NSBitmapImageRep(cgImage: cgImage)
             return rep.representation(using: .png, properties: [:])
             return rep.representation(using: .png, properties: [:])
         #else
         #else
-            #if swift(>=4.2)
             return base.pngData()
             return base.pngData()
-            #else
-            return UIImagePNGRepresentation(base)
-            #endif
         #endif
         #endif
     }
     }
 
 
@@ -221,11 +217,7 @@ extension KingfisherWrapper where Base: KFCrossPlatformImage {
             let rep = NSBitmapImageRep(cgImage: cgImage)
             let rep = NSBitmapImageRep(cgImage: cgImage)
             return rep.representation(using:.jpeg, properties: [.compressionFactor: compressionQuality])
             return rep.representation(using:.jpeg, properties: [.compressionFactor: compressionQuality])
         #else
         #else
-            #if swift(>=4.2)
             return base.jpegData(compressionQuality: compressionQuality)
             return base.jpegData(compressionQuality: compressionQuality)
-            #else
-            return UIImageJPEGRepresentation(base, compressionQuality)
-            #endif
         #endif
         #endif
     }
     }
 
 

+ 0 - 4
Sources/Image/ImageDrawing.swift

@@ -132,11 +132,7 @@ extension KingfisherWrapper where Base: KFCrossPlatformImage {
             }
             }
             
             
             let path = NSBezierPath(roundedRect: rect, byRoundingCorners: corners, radius: radius)
             let path = NSBezierPath(roundedRect: rect, byRoundingCorners: corners, radius: radius)
-            #if swift(>=4.2)
             path.windingRule = .evenOdd
             path.windingRule = .evenOdd
-            #else
-            path.windingRule = .evenOddWindingRule
-            #endif
             path.addClip()
             path.addClip()
             base.draw(in: rect)
             base.draw(in: rect)
             #else
             #else

+ 0 - 154
Sources/Utility/Result.swift

@@ -26,160 +26,6 @@
 
 
 import Foundation
 import Foundation
 
 
-#if swift(>=4.3)
-/// Result type already built-in
-#else
-/// A value that represents either a success or failure, capturing associated
-/// values in both cases.
-public enum Result<Success, Failure> {
-    /// A success, storing a `Value`.
-    case success(Success)
-
-    /// A failure, storing an `Error`.
-    case failure(Failure)
-
-    /// Evaluates the given transform closure when this `Result` instance is
-    /// `.success`, passing the value as a parameter.
-    ///
-    /// Use the `map` method with a closure that returns a non-`Result` value.
-    ///
-    /// - Parameter transform: A closure that takes the successful value of the
-    ///   instance.
-    /// - Returns: A new `Result` instance with the result of the transform, if
-    ///   it was applied.
-    public func map<NewSuccess>(
-        _ transform: (Success) -> NewSuccess
-        ) -> Result<NewSuccess, Failure> {
-        switch self {
-        case let .success(success):
-            return .success(transform(success))
-        case let .failure(failure):
-            return .failure(failure)
-        }
-    }
-
-    /// Evaluates the given transform closure when this `Result` instance is
-    /// `.failure`, passing the error as a parameter.
-    ///
-    /// Use the `mapError` method with a closure that returns a non-`Result`
-    /// value.
-    ///
-    /// - Parameter transform: A closure that takes the failure value of the
-    ///   instance.
-    /// - Returns: A new `Result` instance with the result of the transform, if
-    ///   it was applied.
-    public func mapError<NewFailure>(
-        _ transform: (Failure) -> NewFailure
-        ) -> Result<Success, NewFailure> {
-        switch self {
-        case let .success(success):
-            return .success(success)
-        case let .failure(failure):
-            return .failure(transform(failure))
-        }
-    }
-
-    /// Evaluates the given transform closure when this `Result` instance is
-    /// `.success`, passing the value as a parameter and flattening the result.
-    ///
-    /// - Parameter transform: A closure that takes the successful value of the
-    ///   instance.
-    /// - Returns: A new `Result` instance, either from the transform or from
-    ///   the previous error value.
-    public func flatMap<NewSuccess>(
-        _ transform: (Success) -> Result<NewSuccess, Failure>
-        ) -> Result<NewSuccess, Failure> {
-        switch self {
-        case let .success(success):
-            return transform(success)
-        case let .failure(failure):
-            return .failure(failure)
-        }
-    }
-
-    /// Evaluates the given transform closure when this `Result` instance is
-    /// `.failure`, passing the error as a parameter and flattening the result.
-    ///
-    /// - Parameter transform: A closure that takes the error value of the
-    ///   instance.
-    /// - Returns: A new `Result` instance, either from the transform or from
-    ///   the previous success value.
-    public func flatMapError<NewFailure>(
-        _ transform: (Failure) -> Result<Success, NewFailure>
-        ) -> Result<Success, NewFailure> {
-        switch self {
-        case let .success(success):
-            return .success(success)
-        case let .failure(failure):
-            return transform(failure)
-        }
-    }
-}
-
-extension Result where Failure: Error {
-    /// Returns the success value as a throwing expression.
-    ///
-    /// Use this method to retrieve the value of this result if it represents a
-    /// success, or to catch the value if it represents a failure.
-    ///
-    ///     let integerResult: Result<Int, Error> = .success(5)
-    ///     do {
-    ///         let value = try integerResult.get()
-    ///         print("The value is \(value).")
-    ///     } catch error {
-    ///         print("Error retrieving the value: \(error)")
-    ///     }
-    ///     // Prints "The value is 5."
-    ///
-    /// - Returns: The success value, if the instance represents a success.
-    /// - Throws: The failure value, if the instance represents a failure.
-    public func get() throws -> Success {
-        switch self {
-        case let .success(success):
-            return success
-        case let .failure(failure):
-            throw failure
-        }
-    }
-}
-
-extension Result where Failure == Swift.Error {
-    /// Creates a new result by evaluating a throwing closure, capturing the
-    /// returned value as a success, or any thrown error as a failure.
-    ///
-    /// - Parameter body: A throwing closure to evaluate.
-    @_transparent
-    public init(catching body: () throws -> Success) {
-        do {
-            self = .success(try body())
-        } catch {
-            self = .failure(error)
-        }
-    }
-}
-
-extension Result : Equatable where Success : Equatable, Failure: Equatable { }
-
-extension Result : Hashable where Success : Hashable, Failure : Hashable { }
-
-extension Result : CustomDebugStringConvertible {
-    public var debugDescription: String {
-        var output = "Result."
-        switch self {
-        case let .success(value):
-            output += "success("
-            debugPrint(value, terminator: "", to: &output)
-        case let .failure(error):
-            output += "failure("
-            debugPrint(error, terminator: "", to: &output)
-        }
-        output += ")"
-
-        return output
-    }
-}
-#endif
-
 // These helper methods are not public since we do not want them to be exposed or cause any conflicting.
 // These helper methods are not public since we do not want them to be exposed or cause any conflicting.
 // However, they are just wrapper of `ResultUtil` static methods.
 // However, they are just wrapper of `ResultUtil` static methods.
 extension Result where Failure: Error {
 extension Result where Failure: Error {

+ 1 - 12
Sources/Utility/String+MD5.swift

@@ -34,15 +34,9 @@ extension KingfisherWrapper where Base == String {
             return base
             return base
         }
         }
 
 
-        #if swift(>=5.0)
         let message = data.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in
         let message = data.withUnsafeBytes { (bytes: UnsafeRawBufferPointer) in
             return [UInt8](bytes)
             return [UInt8](bytes)
         }
         }
-        #else
-        let message = data.withUnsafeBytes { bytes in
-            return [UInt8](UnsafeBufferPointer(start: bytes, count: data.count))
-        }
-        #endif
 
 
         let MD5Calculator = MD5(message)
         let MD5Calculator = MD5(message)
         let MD5Data = MD5Calculator.calculate()
         let MD5Data = MD5Calculator.calculate()
@@ -81,14 +75,9 @@ func arrayOfBytes<T>(_ value: T, length: Int? = nil) -> [UInt8] {
         }
         }
         return bytes
         return bytes
     }
     }
-
-    #if swift(>=4.1)
+    
     valuePointer.deinitialize(count: 1)
     valuePointer.deinitialize(count: 1)
     valuePointer.deallocate()
     valuePointer.deallocate()
-    #else
-    valuePointer.deinitialize()
-    valuePointer.deallocate(capacity: 1)
-    #endif
 
 
     return bytes
     return bytes
 }
 }

+ 0 - 4
Sources/Views/AnimatedImageView.swift

@@ -57,11 +57,7 @@ extension AnimatedImageViewDelegate {
     public func animatedImageViewDidFinishAnimating(_ imageView: AnimatedImageView) {}
     public func animatedImageViewDidFinishAnimating(_ imageView: AnimatedImageView) {}
 }
 }
 
 
-#if swift(>=4.2)
 let KFRunLoopModeCommon = RunLoop.Mode.common
 let KFRunLoopModeCommon = RunLoop.Mode.common
-#else
-let KFRunLoopModeCommon = RunLoopMode.commonModes
-#endif
 
 
 /// Represents a subclass of `UIImageView` for displaying animated image.
 /// Represents a subclass of `UIImageView` for displaying animated image.
 /// Different from showing animated image in a normal `UIImageView` (which load all frames at one time),
 /// Different from showing animated image in a normal `UIImageView` (which load all frames at one time),

+ 0 - 4
Sources/Views/Indicator.swift

@@ -157,11 +157,7 @@ final class ActivityIndicator: Indicator {
             }
             }
             #endif
             #endif
 
 
-            #if swift(>=4.2)
             activityIndicatorView = UIActivityIndicatorView(style: indicatorStyle)
             activityIndicatorView = UIActivityIndicatorView(style: indicatorStyle)
-            #else
-            activityIndicatorView = UIActivityIndicatorView(activityIndicatorStyle: indicatorStyle)
-            #endif
         #endif
         #endif
     }
     }
 }
 }

+ 0 - 4
Tests/KingfisherTests/ImageExtensionTests.swift

@@ -42,11 +42,7 @@ class ImageExtensionTests: XCTestCase {
         XCTAssertEqual(format, .GIF)
         XCTAssertEqual(format, .GIF)
         
         
         let raw: [UInt8] = [1, 2, 3, 4, 5, 6, 7, 8]
         let raw: [UInt8] = [1, 2, 3, 4, 5, 6, 7, 8]
-        #if swift(>=5.0)
         format = Data(raw).kf.imageFormat
         format = Data(raw).kf.imageFormat
-        #else
-        format = Data(bytes: raw).kf.imageFormat
-        #endif
         XCTAssertEqual(format, .unknown)
         XCTAssertEqual(format, .unknown)
     }
     }
     
     

+ 0 - 11
fastlane/Fastfile

@@ -7,19 +7,8 @@ platform :ios do
   desc "Runs all the tests"
   desc "Runs all the tests"
   lane :tests do
   lane :tests do
     test(destination: "platform=macOS", swift_version: "5.0")
     test(destination: "platform=macOS", swift_version: "5.0")
-    test(destination: "platform=macOS", swift_version: "4.2")
-    test(destination: "platform=macOS", swift_version: "4.0")
-
     test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "5.0")
     test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "5.0")
-    test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "4.2")
-    test(destination: "platform=iOS Simulator,name=iPhone 8", swift_version: "4.0")
-    
     test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "5.0")
     test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "5.0")
-    test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "4.2")
-    test(destination: "platform=tvOS Simulator,name=Apple TV", swift_version: "4.0")
-    
-    build(destination: "platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm", swift_version: "4.0")
-    build(destination: "platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm", swift_version: "4.2")
     build(destination: "platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm", swift_version: "5.0")
     build(destination: "platform=watchOS Simulator,name=Apple Watch Series 5 - 40mm", swift_version: "5.0")
   end
   end