Update to Swift 4.2

This commit is contained in:
Reda Lemeden 2018-09-19 12:10:33 +01:00
parent ba508c8bf1
commit f1a9e9f5cc
8 changed files with 23 additions and 25 deletions

View File

@ -139,7 +139,7 @@
9D98823619BC69CA00B790C6 = { 9D98823619BC69CA00B790C6 = {
CreatedOnToolsVersion = 6.0; CreatedOnToolsVersion = 6.0;
DevelopmentTeam = 5G38N4D8G2; DevelopmentTeam = 5G38N4D8G2;
LastSwiftMigration = 0900; LastSwiftMigration = 1000;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
}; };
@ -306,8 +306,7 @@
PRODUCT_BUNDLE_IDENTIFIER = co.kaishin.gifu.demo; PRODUCT_BUNDLE_IDENTIFIER = co.kaishin.gifu.demo;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1; TARGETED_DEVICE_FAMILY = 1;
}; };
name = Debug; name = Debug;
@ -327,8 +326,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = ""; PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2;
SWIFT_VERSION = 4.0;
TARGETED_DEVICE_FAMILY = 1; TARGETED_DEVICE_FAMILY = 1;
}; };
name = Release; name = Release;

View File

@ -5,7 +5,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow? var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true return true
} }
} }

View File

@ -12,7 +12,7 @@ class DummyAnimatable: GIFAnimatable {
var image: UIImage? = nil var image: UIImage? = nil
var layer = CALayer() var layer = CALayer()
var frame: CGRect = .zero var frame: CGRect = .zero
var contentMode: UIViewContentMode = .scaleToFill var contentMode: UIView.ContentMode = .scaleToFill
func animatorHasNewFrame() {} func animatorHasNewFrame() {}
} }

View File

@ -353,15 +353,17 @@
}; };
00B8C73D1A364DA400C188E7 = { 00B8C73D1A364DA400C188E7 = {
CreatedOnToolsVersion = 6.1.1; CreatedOnToolsVersion = 6.1.1;
LastSwiftMigration = 0900; LastSwiftMigration = 1000;
ProvisioningStyle = Manual; ProvisioningStyle = Manual;
}; };
71E8B2DC20387D830037BA62 = { 71E8B2DC20387D830037BA62 = {
CreatedOnToolsVersion = 9.2; CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
71E8B2E420387D830037BA62 = { 71E8B2E420387D830037BA62 = {
CreatedOnToolsVersion = 9.2; CreatedOnToolsVersion = 9.2;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic; ProvisioningStyle = Automatic;
}; };
}; };
@ -664,8 +666,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2;
SWIFT_VERSION = 4.0;
}; };
name = Debug; name = Debug;
}; };
@ -688,8 +689,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 4.2;
SWIFT_VERSION = 4.0;
}; };
name = Release; name = Release;
}; };
@ -717,7 +717,7 @@
SDKROOT = appletvos; SDKROOT = appletvos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.0; SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3; TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 11.2; TVOS_DEPLOYMENT_TARGET = 11.2;
}; };
@ -748,7 +748,7 @@
SDKROOT = appletvos; SDKROOT = appletvos;
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0; SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3; TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 11.2; TVOS_DEPLOYMENT_TARGET = 11.2;
}; };
@ -772,7 +772,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos; SDKROOT = appletvos;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_VERSION = 4.0; SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3; TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 11.2; TVOS_DEPLOYMENT_TARGET = 11.2;
}; };
@ -797,7 +797,7 @@
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = appletvos; SDKROOT = appletvos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0; SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3; TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 11.2; TVOS_DEPLOYMENT_TARGET = 11.2;
}; };

View File

@ -70,7 +70,7 @@ public class Animator {
/// - parameter contentMode: The view content mode to use for the individual frames. /// - parameter contentMode: The view content mode to use for the individual frames.
/// - parameter loopCount: Desired number of loops, <= 0 for infinite loop. /// - parameter loopCount: Desired number of loops, <= 0 for infinite loop.
/// - parameter completionHandler: Completion callback function /// - 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], guard let extensionRemoved = imageName.components(separatedBy: ".")[safe: 0],
let imagePath = Bundle.main.url(forResource: extensionRemoved, withExtension: "gif"), let imagePath = Bundle.main.url(forResource: extensionRemoved, withExtension: "gif"),
let data = try? Data(contentsOf: imagePath) else { return } 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 contentMode: The view content mode to use for the individual frames.
/// - parameter loopCount: Desired number of loops, <= 0 for infinite loop. /// - parameter loopCount: Desired number of loops, <= 0 for infinite loop.
/// - parameter completionHandler: Completion callback function /// - 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, frameStore = FrameStore(data: imageData,
size: size, size: size,
contentMode: contentMode, contentMode: contentMode,
@ -102,7 +102,7 @@ public class Animator {
/// Add the display link to the main run loop. /// Add the display link to the main run loop.
private func attachDisplayLink() { private func attachDisplayLink() {
displayLink.add(to: .main, forMode: RunLoopMode.commonModes) displayLink.add(to: .main, forMode: RunLoop.Mode.common)
} }
deinit { deinit {
@ -130,7 +130,7 @@ public class Animator {
/// - parameter contentMode: The view content mode to use for the individual frames. /// - parameter contentMode: The view content mode to use for the individual frames.
/// - parameter loopCount: Desired number of loops, <= 0 for infinite loop. /// - parameter loopCount: Desired number of loops, <= 0 for infinite loop.
/// - parameter completionHandler: Completion callback function /// - 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, prepareForAnimation(withGIFNamed: imageName,
size: size, size: size,
contentMode: contentMode, contentMode: contentMode,
@ -146,7 +146,7 @@ public class Animator {
/// - parameter contentMode: The view content mode to use for the individual frames. /// - parameter contentMode: The view content mode to use for the individual frames.
/// - parameter loopCount: Desired number of loops, <= 0 for infinite loop. /// - parameter loopCount: Desired number of loops, <= 0 for infinite loop.
/// - parameter completionHandler: Completion callback function /// - 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, prepareForAnimation(withGIFData: imageData,
size: size, size: size,
contentMode: contentMode, contentMode: contentMode,

View File

@ -26,7 +26,7 @@ class FrameStore {
let size: CGSize let size: CGSize
/// The content mode to use when resizing. /// The content mode to use when resizing.
let contentMode: UIViewContentMode let contentMode: UIView.ContentMode
/// Maximum number of frames to load at once /// Maximum number of frames to load at once
let bufferFrameCount: Int let bufferFrameCount: Int
@ -83,7 +83,7 @@ class FrameStore {
/// ///
/// - parameter data: The raw GIF image data. /// - parameter data: The raw GIF image data.
/// - parameter delegate: An `Animatable` delegate. /// - 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 let options = [String(kCGImageSourceShouldCache): kCFBooleanFalse] as CFDictionary
self.imageSource = CGImageSourceCreateWithData(data as CFData, options) ?? CGImageSourceCreateIncremental(options) self.imageSource = CGImageSourceCreateWithData(data as CFData, options) ?? CGImageSourceCreateIncremental(options)
self.size = size self.size = size

View File

@ -13,7 +13,7 @@ public protocol GIFAnimatable: class {
var frame: CGRect { get set } var frame: CGRect { get set }
/// Content mode used for resizing the frames. /// Content mode used for resizing the frames.
var contentMode: UIViewContentMode { get set } var contentMode: UIView.ContentMode { get set }
} }

View File

@ -19,7 +19,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>146</string> <string>147</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string></string> <string></string>
</dict> </dict>