diff --git a/Animo.xcodeproj/project.pbxproj b/Animo.xcodeproj/project.pbxproj index deafbf1..9784df3 100644 --- a/Animo.xcodeproj/project.pbxproj +++ b/Animo.xcodeproj/project.pbxproj @@ -443,7 +443,7 @@ SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -498,7 +498,7 @@ SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; SWIFT_SWIFT3_OBJC_INFERENCE = Off; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -519,7 +519,6 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -536,7 +535,6 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; SKIP_INSTALL = YES; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; }; name = Release; }; @@ -547,7 +545,6 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.eure.ios.AnimoTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -558,7 +555,6 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = jp.eure.ios.AnimoTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; }; name = Release; }; @@ -576,7 +572,6 @@ MACOSX_DEPLOYMENT_TARGET = 10.10; SDKROOT = macosx; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -594,7 +589,6 @@ MACOSX_DEPLOYMENT_TARGET = 10.10; SDKROOT = macosx; SKIP_INSTALL = YES; - SWIFT_VERSION = 4.0; }; name = Release; }; diff --git a/Animo/Internal/CAAnimation+AnimoInternals.swift b/Animo/Internal/CAAnimation+AnimoInternals.swift index f6d2f3b..e12ae71 100644 --- a/Animo/Internal/CAAnimation+AnimoInternals.swift +++ b/Animo/Internal/CAAnimation+AnimoInternals.swift @@ -37,7 +37,7 @@ internal extension CAAnimation { internal func applyOptions(_ options: Options = .default) { self.speed = Float(options.speed) - self.fillMode = options.fillMode + self.fillMode = CAMediaTimingFillMode(rawValue: options.fillMode) self.isRemovedOnCompletion = options.removedOnCompletion } } diff --git a/Animo/Internal/Transition+AnimoInternals.swift b/Animo/Internal/Transition+AnimoInternals.swift index 068c34b..f493fc0 100644 --- a/Animo/Internal/Transition+AnimoInternals.swift +++ b/Animo/Internal/Transition+AnimoInternals.swift @@ -40,30 +40,30 @@ internal extension Transition { switch direction { - case .leftToRight: return kCATransitionFromLeft - case .rightToLeft: return kCATransitionFromRight - case .topToBottom: return kCATransitionFromTop - case .bottomToTop: return kCATransitionFromBottom + case .leftToRight: return CATransitionSubtype.fromLeft.rawValue + case .rightToLeft: return CATransitionSubtype.fromRight.rawValue + case .topToBottom: return CATransitionSubtype.fromTop.rawValue + case .bottomToTop: return CATransitionSubtype.fromBottom.rawValue } } switch self { case .fade: - object.type = kCATransitionFade + object.type = CATransitionType.fade object.subtype = nil case .moveIn(let direction): - object.type = kCATransitionMoveIn - object.subtype = subtypeForCATransition(direction) + object.type = CATransitionType.moveIn + object.subtype = CATransitionSubtype(rawValue: subtypeForCATransition(direction)) case .push(let direction): - object.type = kCATransitionPush - object.subtype = subtypeForCATransition(direction) + object.type = CATransitionType.push + object.subtype = CATransitionSubtype(rawValue: subtypeForCATransition(direction)) case .reveal(let direction): - object.type = kCATransitionReveal - object.subtype = subtypeForCATransition(direction) + object.type = CATransitionType.reveal + object.subtype = CATransitionSubtype(rawValue: subtypeForCATransition(direction)) } } } diff --git a/Animo/KeyframeValueConvertible.swift b/Animo/KeyframeValueConvertible.swift index c2ed53c..e0ae575 100644 --- a/Animo/KeyframeValueConvertible.swift +++ b/Animo/KeyframeValueConvertible.swift @@ -233,18 +233,18 @@ extension NSObject: KeyframeValueConvertible { var points = Array(repeating: .zero, count: 3) switch self.element(at: index, associatedPoints: &points) { - case .moveToBezierPathElement: + case .moveTo: path.move(to: points[0]) - case .lineToBezierPathElement: + case .lineTo: path.addLine(to: points[0]) didClosePath = false - case .curveToBezierPathElement: + case .curveTo: path.addCurve(to: points[0], control1: points[1], control2: points[2]) didClosePath = false - case .closePathBezierPathElement: + case .closePath: path.closeSubpath() didClosePath = true } @@ -296,7 +296,7 @@ extension CGFloat: FloatingPointKeyframeValueConvertible { public var degreesToRadians: CGFloat { - return CGFloat(Double.greatestFiniteMagnitude * Double(self) / 180.0) + return CGFloat(Double.pi * Double(self) / 180.0) } } diff --git a/Animo/Options.swift b/Animo/Options.swift index 5b0eec9..e51d523 100644 --- a/Animo/Options.swift +++ b/Animo/Options.swift @@ -56,10 +56,10 @@ public struct Options { switch fillMode { - case FillMode.forwards: return kCAFillModeForwards - case FillMode.backwards: return kCAFillModeBackwards - case FillMode.both: return kCAFillModeBoth - default: return kCAFillModeRemoved + case FillMode.forwards: return CAMediaTimingFillMode.forwards.rawValue + case FillMode.backwards: return CAMediaTimingFillMode.backwards.rawValue + case FillMode.both: return CAMediaTimingFillMode.both.rawValue + default: return CAMediaTimingFillMode.removed.rawValue } } diff --git a/Animo/TimingMode.swift b/Animo/TimingMode.swift index b51ebaa..12784c3 100644 --- a/Animo/TimingMode.swift +++ b/Animo/TimingMode.swift @@ -57,10 +57,10 @@ public enum TimingMode { switch self { - case .linear: return CAMediaTimingFunction(name: kCAMediaTimingFunctionLinear) - case .easeIn: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn) - case .easeOut: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut) - case .easeInOut: return CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) + case .linear: return CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear) + case .easeIn: return CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeIn) + case .easeOut: return CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut) + case .easeInOut: return CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut) case .spring(let damping): return CAMediaTimingFunction(controlPoints: 0.5, 1.1 + (Float(damping) / 3.0), 1, 1) case .discrete: return CAMediaTimingFunction(controlPoints: 1, 0, 1, 1)