Skip to content

Commit

Permalink
Update to Swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Reda Lemeden committed Sep 19, 2018
1 parent ba508c8 commit f1a9e9f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 25 deletions.
8 changes: 3 additions & 5 deletions Demo/Demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
9D98823619BC69CA00B790C6 = {
CreatedOnToolsVersion = 6.0;
DevelopmentTeam = 5G38N4D8G2;
LastSwiftMigration = 0900;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
};
};
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Demo/Source/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
2 changes: 1 addition & 1 deletion Gifu-tvOSTests/Gifu-tvOSTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}
}

Expand Down
18 changes: 9 additions & 9 deletions Gifu.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
};
Expand Down Expand Up @@ -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;
};
Expand All @@ -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;
};
Expand Down Expand Up @@ -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;
};
Expand Down Expand Up @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand Down
10 changes: 5 additions & 5 deletions Source/Classes/Animator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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,
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions Source/Classes/FrameStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/Classes/GIFAnimatable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
}


Expand Down
2 changes: 1 addition & 1 deletion Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>146</string>
<string>147</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
Expand Down

0 comments on commit f1a9e9f

Please sign in to comment.