diff --git a/Demo/Demo.xcodeproj/project.pbxproj b/Demo/Demo.xcodeproj/project.pbxproj index e5adbab..fc990ca 100755 --- a/Demo/Demo.xcodeproj/project.pbxproj +++ b/Demo/Demo.xcodeproj/project.pbxproj @@ -139,7 +139,7 @@ 9D98823619BC69CA00B790C6 = { CreatedOnToolsVersion = 6.0; DevelopmentTeam = 5G38N4D8G2; - LastSwiftMigration = 0900; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; }; @@ -306,8 +306,7 @@ PRODUCT_BUNDLE_IDENTIFIER = co.kaishin.gifu.demo; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 1; }; name = Debug; @@ -327,8 +326,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 1; }; name = Release; diff --git a/Demo/Source/AppDelegate.swift b/Demo/Source/AppDelegate.swift index 1c846fe..ae3aff5 100755 --- a/Demo/Source/AppDelegate.swift +++ b/Demo/Source/AppDelegate.swift @@ -5,7 +5,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { var window: UIWindow? - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { return true } } diff --git a/Gifu-tvOSTests/Gifu-tvOSTests.swift b/Gifu-tvOSTests/Gifu-tvOSTests.swift index 0585c79..82a4f4f 100644 --- a/Gifu-tvOSTests/Gifu-tvOSTests.swift +++ b/Gifu-tvOSTests/Gifu-tvOSTests.swift @@ -12,7 +12,7 @@ class DummyAnimatable: GIFAnimatable { var image: UIImage? = nil var layer = CALayer() var frame: CGRect = .zero - var contentMode: UIViewContentMode = .scaleToFill + var contentMode: UIView.ContentMode = .scaleToFill func animatorHasNewFrame() {} } diff --git a/Gifu.xcodeproj/project.pbxproj b/Gifu.xcodeproj/project.pbxproj index 4cff8b3..e9e718f 100644 --- a/Gifu.xcodeproj/project.pbxproj +++ b/Gifu.xcodeproj/project.pbxproj @@ -353,15 +353,17 @@ }; 00B8C73D1A364DA400C188E7 = { CreatedOnToolsVersion = 6.1.1; - LastSwiftMigration = 0900; + LastSwiftMigration = 1000; ProvisioningStyle = Manual; }; 71E8B2DC20387D830037BA62 = { CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; 71E8B2E420387D830037BA62 = { CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1000; ProvisioningStyle = Automatic; }; }; @@ -664,8 +666,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -688,8 +689,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -717,7 +717,7 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 11.2; }; @@ -748,7 +748,7 @@ SDKROOT = appletvos; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 11.2; }; @@ -772,7 +772,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 11.2; }; @@ -797,7 +797,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = appletvos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = 3; TVOS_DEPLOYMENT_TARGET = 11.2; }; diff --git a/Source/Classes/Animator.swift b/Source/Classes/Animator.swift index e59e006..544e794 100644 --- a/Source/Classes/Animator.swift +++ b/Source/Classes/Animator.swift @@ -70,7 +70,7 @@ public class Animator { /// - parameter contentMode: The view content mode to use for the individual frames. /// - parameter loopCount: Desired number of loops, <= 0 for infinite loop. /// - parameter completionHandler: Completion callback function - func prepareForAnimation(withGIFNamed imageName: String, size: CGSize, contentMode: UIViewContentMode, loopCount: Int = 0, completionHandler: (() -> Void)? = nil) { + func prepareForAnimation(withGIFNamed imageName: String, size: CGSize, contentMode: UIView.ContentMode, loopCount: Int = 0, completionHandler: (() -> Void)? = nil) { guard let extensionRemoved = imageName.components(separatedBy: ".")[safe: 0], let imagePath = Bundle.main.url(forResource: extensionRemoved, withExtension: "gif"), let data = try? Data(contentsOf: imagePath) else { return } @@ -89,7 +89,7 @@ public class Animator { /// - parameter contentMode: The view content mode to use for the individual frames. /// - parameter loopCount: Desired number of loops, <= 0 for infinite loop. /// - parameter completionHandler: Completion callback function - func prepareForAnimation(withGIFData imageData: Data, size: CGSize, contentMode: UIViewContentMode, loopCount: Int = 0, completionHandler: (() -> Void)? = nil) { + func prepareForAnimation(withGIFData imageData: Data, size: CGSize, contentMode: UIView.ContentMode, loopCount: Int = 0, completionHandler: (() -> Void)? = nil) { frameStore = FrameStore(data: imageData, size: size, contentMode: contentMode, @@ -102,7 +102,7 @@ public class Animator { /// Add the display link to the main run loop. private func attachDisplayLink() { - displayLink.add(to: .main, forMode: RunLoopMode.commonModes) + displayLink.add(to: .main, forMode: RunLoop.Mode.common) } deinit { @@ -130,7 +130,7 @@ public class Animator { /// - parameter contentMode: The view content mode to use for the individual frames. /// - parameter loopCount: Desired number of loops, <= 0 for infinite loop. /// - parameter completionHandler: Completion callback function - func animate(withGIFNamed imageName: String, size: CGSize, contentMode: UIViewContentMode, loopCount: Int = 0, completionHandler: (() -> Void)? = nil) { + func animate(withGIFNamed imageName: String, size: CGSize, contentMode: UIView.ContentMode, loopCount: Int = 0, completionHandler: (() -> Void)? = nil) { prepareForAnimation(withGIFNamed: imageName, size: size, contentMode: contentMode, @@ -146,7 +146,7 @@ public class Animator { /// - parameter contentMode: The view content mode to use for the individual frames. /// - parameter loopCount: Desired number of loops, <= 0 for infinite loop. /// - parameter completionHandler: Completion callback function - func animate(withGIFData imageData: Data, size: CGSize, contentMode: UIViewContentMode, loopCount: Int = 0, completionHandler: (() -> Void)? = nil) { + func animate(withGIFData imageData: Data, size: CGSize, contentMode: UIView.ContentMode, loopCount: Int = 0, completionHandler: (() -> Void)? = nil) { prepareForAnimation(withGIFData: imageData, size: size, contentMode: contentMode, diff --git a/Source/Classes/FrameStore.swift b/Source/Classes/FrameStore.swift index 3941602..63eb187 100644 --- a/Source/Classes/FrameStore.swift +++ b/Source/Classes/FrameStore.swift @@ -26,7 +26,7 @@ class FrameStore { let size: CGSize /// The content mode to use when resizing. - let contentMode: UIViewContentMode + let contentMode: UIView.ContentMode /// Maximum number of frames to load at once let bufferFrameCount: Int @@ -83,7 +83,7 @@ class FrameStore { /// /// - parameter data: The raw GIF image data. /// - parameter delegate: An `Animatable` delegate. - init(data: Data, size: CGSize, contentMode: UIViewContentMode, framePreloadCount: Int, loopCount: Int) { + init(data: Data, size: CGSize, contentMode: UIView.ContentMode, framePreloadCount: Int, loopCount: Int) { let options = [String(kCGImageSourceShouldCache): kCFBooleanFalse] as CFDictionary self.imageSource = CGImageSourceCreateWithData(data as CFData, options) ?? CGImageSourceCreateIncremental(options) self.size = size diff --git a/Source/Classes/GIFAnimatable.swift b/Source/Classes/GIFAnimatable.swift index f7349a1..e8e53e1 100644 --- a/Source/Classes/GIFAnimatable.swift +++ b/Source/Classes/GIFAnimatable.swift @@ -13,7 +13,7 @@ public protocol GIFAnimatable: class { var frame: CGRect { get set } /// Content mode used for resizing the frames. - var contentMode: UIViewContentMode { get set } + var contentMode: UIView.ContentMode { get set } } diff --git a/Supporting Files/Info.plist b/Supporting Files/Info.plist index 3b2492a..4d42ae0 100644 --- a/Supporting Files/Info.plist +++ b/Supporting Files/Info.plist @@ -19,7 +19,7 @@ CFBundleSignature ???? CFBundleVersion - 146 + 147 NSPrincipalClass