diff --git a/Demo/SicaDemo.xcodeproj/project.pbxproj b/Demo/SicaDemo.xcodeproj/project.pbxproj
index bd91a95..2e963e6 100644
--- a/Demo/SicaDemo.xcodeproj/project.pbxproj
+++ b/Demo/SicaDemo.xcodeproj/project.pbxproj
@@ -320,7 +320,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.funzin.sica-demo-app";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -341,7 +341,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.funzin.sica-demo-app";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
diff --git a/Demo/SicaDemo/AppDelegate.swift b/Demo/SicaDemo/AppDelegate.swift
index 8bf0ee0..cfd66d0 100644
--- a/Demo/SicaDemo/AppDelegate.swift
+++ b/Demo/SicaDemo/AppDelegate.swift
@@ -13,7 +13,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
- func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
+ #if swift(>=4.2)
+ typealias LaunchOptionsKey = UIApplication.LaunchOptionsKey
+ #else
+ typealias LaunchOptionsKey = UIApplicationLaunchOptionsKey
+ #endif
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
diff --git a/README.md b/README.md
index e36e3bb..486808a 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
-
+
@@ -33,10 +33,11 @@ Sica can execute various animations sequentially or parallelly.
- Transition
## Requirements
-- Xcode 9.3
+- Xcode 9.3 or greater
- iOS 9 or greater
- tvOS 10.0 or greater
- macOS 10.11 or greater
+- Swift 4.2 (since 0.3.4)
## Installation
@@ -63,7 +64,7 @@ pod 'Sica'
Sica is available through `SwiftPM`, create ` Package.swift` and add `dependencies` value
```Package.swift
dependencies: [
- .package(url: "https://github.com/cats-oss/Sica.git", from: "0.3.3")
+ .package(url: "https://github.com/cats-oss/Sica.git", from: "0.3.4")
]
```
See also: [GitHub - j-channings/swift-package-manager-ios: Example of how to use SPM v4 to manage iOS dependencies](https://github.com/j-channings/swift-package-manager-ios)
diff --git a/Sica.podspec b/Sica.podspec
index e95b719..27b6648 100644
--- a/Sica.podspec
+++ b/Sica.podspec
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "Sica"
- s.version = "0.3.3"
+ s.version = "0.3.4"
s.summary = "Sica can execute various animations sequentially or parallely"
s.homepage = "https://github.com/cats-oss/Sica"
s.license = { :type => "MIT", :file => "LICENSE" }
@@ -18,5 +18,5 @@ Pod::Spec.new do |s|
s.osx.deployment_target = "10.11"
s.source = { :git => "https://github.com/cats-oss/Sica.git", :tag => "#{s.version}" }
s.source_files = "Sica/**/*.{swift}"
- s.swift_version = '4.1'
+ s.swift_version = '4.2'
end
diff --git a/Sica.xcodeproj/project.pbxproj b/Sica.xcodeproj/project.pbxproj
index d0df844..392d53b 100644
--- a/Sica.xcodeproj/project.pbxproj
+++ b/Sica.xcodeproj/project.pbxproj
@@ -7,6 +7,9 @@
objects = {
/* Begin PBXBuildFile section */
+ 313DA7AB215D2C3100842816 /* FillMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 313DA7AA215D2C3100842816 /* FillMode.swift */; };
+ 313DA7AC215D2DBC00842816 /* FillMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 313DA7AA215D2C3100842816 /* FillMode.swift */; };
+ 313DA7AD215D2DBD00842816 /* FillMode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 313DA7AA215D2C3100842816 /* FillMode.swift */; };
9D436C3220E9E4DD00A1B938 /* TimingFunction.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C620AC2BDD003232F6 /* TimingFunction.swift */; };
9D436C3320E9E4DD00A1B938 /* Transition.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C220AC2BDD003232F6 /* Transition.swift */; };
9D436C3420E9E4DD00A1B938 /* CAAnimation+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4CB78C120AC2BDD003232F6 /* CAAnimation+Extension.swift */; };
@@ -64,6 +67,7 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
+ 313DA7AA215D2C3100842816 /* FillMode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FillMode.swift; sourceTree = ""; };
9D436C3F20E9E4DD00A1B938 /* Sica.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sica.framework; sourceTree = BUILT_PRODUCTS_DIR; };
9D436C4120E9E62700A1B938 /* Info-macOS.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-macOS.plist"; sourceTree = ""; };
9D436C5120E9E71900A1B938 /* Sica.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Sica.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -196,6 +200,7 @@
D4CB78C420AC2BDD003232F6 /* Animator.swift */,
D4CB78C120AC2BDD003232F6 /* CAAnimation+Extension.swift */,
D449535220EE1F20004C8AB9 /* CALayer+Sica.swift */,
+ 313DA7AA215D2C3100842816 /* FillMode.swift */,
D4CB78C620AC2BDD003232F6 /* TimingFunction.swift */,
D4CB78C220AC2BDD003232F6 /* Transition.swift */,
D449535020EE1BAF004C8AB9 /* View+Sica.swift */,
@@ -482,6 +487,7 @@
9D436C3420E9E4DD00A1B938 /* CAAnimation+Extension.swift in Sources */,
9D436C3520E9E4DD00A1B938 /* Animator.swift in Sources */,
9D68159820EF10BF007B3FB0 /* View+Sica.swift in Sources */,
+ 313DA7AC215D2DBC00842816 /* FillMode.swift in Sources */,
9D436C3620E9E4DD00A1B938 /* AnimationKeyPaths.swift in Sources */,
9D68159620EF10BB007B3FB0 /* CALayer+Sica.swift in Sources */,
);
@@ -496,6 +502,7 @@
9D436C4620E9E71900A1B938 /* CAAnimation+Extension.swift in Sources */,
9D436C4720E9E71900A1B938 /* Animator.swift in Sources */,
9D68159920EF10BF007B3FB0 /* View+Sica.swift in Sources */,
+ 313DA7AD215D2DBD00842816 /* FillMode.swift in Sources */,
9D436C4820E9E71900A1B938 /* AnimationKeyPaths.swift in Sources */,
9D68159720EF10BC007B3FB0 /* CALayer+Sica.swift in Sources */,
);
@@ -526,6 +533,7 @@
D4CB78CA20AC2BDD003232F6 /* CAAnimation+Extension.swift in Sources */,
D4CB78CD20AC2BDD003232F6 /* Animator.swift in Sources */,
D449535320EE1F20004C8AB9 /* CALayer+Sica.swift in Sources */,
+ 313DA7AB215D2C3100842816 /* FillMode.swift in Sources */,
D449535120EE1BAF004C8AB9 /* View+Sica.swift in Sources */,
D4CB78CE20AC2BDD003232F6 /* AnimationKeyPaths.swift in Sources */,
);
@@ -584,7 +592,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SKIP_INSTALL = YES;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -613,7 +621,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
SKIP_INSTALL = YES;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@@ -641,7 +649,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
@@ -670,7 +678,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
SKIP_INSTALL = YES;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
TVOS_DEPLOYMENT_TARGET = 10.0;
};
@@ -693,7 +701,7 @@
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
};
name = Debug;
@@ -715,7 +723,7 @@
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = appletvos;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = 3;
};
name = Release;
@@ -737,7 +745,7 @@
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -759,7 +767,7 @@
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = macosx;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@@ -906,7 +914,7 @@
PRODUCT_NAME = Sica;
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -933,7 +941,7 @@
PRODUCT_NAME = Sica;
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
@@ -954,7 +962,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.cats-oss.SicaTests";
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
@@ -975,7 +983,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.cats-oss.SicaTests";
PRODUCT_NAME = SicaTests;
PROVISIONING_PROFILE_SPECIFIER = "";
- SWIFT_VERSION = 4.0;
+ SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
diff --git a/Sica/Source/Animator.swift b/Sica/Source/Animator.swift
index 9917736..79a9898 100644
--- a/Sica/Source/Animator.swift
+++ b/Sica/Source/Animator.swift
@@ -107,7 +107,7 @@ public final class Animator {
}
group.animations = animations
group.duration = totalDuration(type: type)
- group.fillMode = kCAFillModeForwards
+ group.fillMode = FillMode.forwards.rawValue
group.isRemovedOnCompletion = isRemovedOnCompletion
if let completion = completion {
diff --git a/Sica/Source/CAAnimation+Extension.swift b/Sica/Source/CAAnimation+Extension.swift
index dead41b..204715c 100644
--- a/Sica/Source/CAAnimation+Extension.swift
+++ b/Sica/Source/CAAnimation+Extension.swift
@@ -13,7 +13,7 @@ extension CAAnimation {
self.beginTime = delay
self.duration = duration
self.timingFunction = timingFunction.rawValue
- self.fillMode = kCAFillModeForwards
+ self.fillMode = FillMode.forwards.rawValue
self.isRemovedOnCompletion = isRemovedOnCompletion
}
}
diff --git a/Sica/Source/FillMode.swift b/Sica/Source/FillMode.swift
new file mode 100644
index 0000000..3d6469e
--- /dev/null
+++ b/Sica/Source/FillMode.swift
@@ -0,0 +1,27 @@
+//
+// FillMode.swift
+// Sica-iOS
+//
+// Created by 中澤郁斗 on 2018/09/28.
+// Copyright © 2018年 中澤 郁斗. All rights reserved.
+//
+
+import Foundation
+
+public struct FillMode {
+ #if swift(>=4.2)
+ typealias RawValue = CAMediaTimingFillMode
+ public static let forwards = FillMode(rawValue: .forwards)
+ public static let backwards = FillMode(rawValue: .backwards)
+ public static let both = FillMode(rawValue: .both)
+ public static let removed = FillMode(rawValue: .removed)
+ #else
+ typealias RawValue = String
+ public static let forwards = FillMode(rawValue: kCAFillModeForwards)
+ public static let backwards = FillMode(rawValue: kCAFillModeBackwards)
+ public static let both = FillMode(rawValue: kCAFillModeBoth)
+ public static let removed = FillMode(rawValue: kCAFillModeRemoved)
+ #endif
+
+ let rawValue: RawValue
+}
diff --git a/Sica/Source/TimingFunction.swift b/Sica/Source/TimingFunction.swift
index 6af93a6..f6c554d 100644
--- a/Sica/Source/TimingFunction.swift
+++ b/Sica/Source/TimingFunction.swift
@@ -9,26 +9,37 @@
import QuartzCore
public struct TimingFunction {
+ #if swift(>=4.2)
+ public typealias NameValue = CAMediaTimingFunctionName
+ public static let `default` = TimingFunction(name: CAMediaTimingFunctionName.default)
+ public static let linear = TimingFunction(name: CAMediaTimingFunctionName.linear)
+ public static let easeIn = TimingFunction(name: CAMediaTimingFunctionName.easeIn)
+ public static let easeOut = TimingFunction(name: CAMediaTimingFunctionName.easeOut)
+ public static let easeInEaseOut = TimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
+ #else
+ public typealias NameValue = String
public static let `default` = TimingFunction(name: kCAMediaTimingFunctionDefault)
public static let linear = TimingFunction(name: kCAMediaTimingFunctionLinear)
public static let easeIn = TimingFunction(name: kCAMediaTimingFunctionEaseIn)
public static let easeOut = TimingFunction(name: kCAMediaTimingFunctionEaseOut)
public static let easeInEaseOut = TimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
+ #endif
- public let name: String
+
+ public let name: NameValue
public let rawValue: CAMediaTimingFunction
- init(name: String) {
+ init(name: NameValue) {
self.name = name
self.rawValue = CAMediaTimingFunction(name: name)
}
- init(name: String, rawValue: CAMediaTimingFunction) {
+ init(name: NameValue, rawValue: CAMediaTimingFunction) {
self.name = name
self.rawValue = rawValue
}
- public init(name: String, controlPoints c1x: Float, _ c1y: Float, _ c2x: Float, _ c2y: Float) {
+ public init(name: NameValue, controlPoints c1x: Float, _ c1y: Float, _ c2x: Float, _ c2y: Float) {
self.name = name
self.rawValue = CAMediaTimingFunction(controlPoints: c1x, c1y, c2x, c2y)
}
@@ -36,6 +47,32 @@ public struct TimingFunction {
// - SeeAlso: https://github.com/ai/easings.net/
extension TimingFunction {
+ #if swift(>=4.2)
+ public static let easeInSine = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInSine"), controlPoints: 0.47, 0, 0.745, 0.715)
+ public static let easeOutSine = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutSine"), controlPoints: 0.39, 0.575, 0.565, 1)
+ public static let easeInOutSine = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutSine"), controlPoints: 0.445, 0.05, 0.55, 0.95)
+ public static let easeInQuad = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInQuad"), controlPoints: 0.55, 0.085, 0.68, 0.53)
+ public static let easeOutQuad = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutQuad"), controlPoints: 0.25, 0.46, 0.45, 0.94)
+ public static let easeInOutQuad = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutQuad"), controlPoints: 0.455, 0.03, 0.515, 0.955)
+ public static let easeInCubic = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInCubic"), controlPoints: 0.55, 0.055, 0.675, 0.19)
+ public static let easeOutCubic = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutCubic"), controlPoints: 0.215, 0.61, 0.355, 1)
+ public static let easeInOutCubic = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutCubic"), controlPoints: 0.645, 0.045, 0.355, 1)
+ public static let easeInQuart = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInQuart"), controlPoints: 0.895, 0.03, 0.685, 0.22)
+ public static let easeOutQuart = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutQuart"), controlPoints: 0.165, 0.84, 0.44, 1)
+ public static let easeInOutQuart = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutQuart"), controlPoints: 0.77, 0, 0.175, 1)
+ public static let easeInQuint = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInQuint"), controlPoints: 0.755, 0.05, 0.855, 0.06)
+ public static let easeOutQuint = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutQuint"), controlPoints: 0.23, 1, 0.32, 1)
+ public static let easeInOutQuint = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutQuint"), controlPoints: 0.86, 0, 0.07, 1)
+ public static let easeInExpo = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInExpo"), controlPoints: 0.95, 0.05, 0.795, 0.035)
+ public static let easeOutExpo = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutExpo"), controlPoints: 0.19, 1, 0.22, 1)
+ public static let easeInOutExpo = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutExpo"), controlPoints: 1, 0, 0, 1)
+ public static let easeInCirc = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInCirc"), controlPoints: 0.6, 0.04, 0.98, 0.335)
+ public static let easeOutCirc = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutCirc"), controlPoints: 0.075, 0.82, 0.165, 1)
+ public static let easeInOutCirc = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutCirc"), controlPoints: 0.785, 0.135, 0.15, 0.86)
+ public static let easeInBack = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInBack"), controlPoints: 0.6, -0.28, 0.735, 0.045)
+ public static let easeOutBack = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeOutBack"), controlPoints: 0.175, 0.885, 0.32, 1.275)
+ public static let easeInOutBack = TimingFunction(name: TimingFunction.NameValue(rawValue: "easeInOutBack"), controlPoints: 0.68, -0.55, 0.265, 1.55)
+ #else
public static let easeInSine = TimingFunction(name: "easeInSine", controlPoints: 0.47, 0, 0.745, 0.715)
public static let easeOutSine = TimingFunction(name: "easeOutSine", controlPoints: 0.39, 0.575, 0.565, 1)
public static let easeInOutSine = TimingFunction(name: "easeInOutSine", controlPoints: 0.445, 0.05, 0.55, 0.95)
@@ -60,4 +97,5 @@ extension TimingFunction {
public static let easeInBack = TimingFunction(name: "easeInBack", controlPoints: 0.6, -0.28, 0.735, 0.045)
public static let easeOutBack = TimingFunction(name: "easeOutBack", controlPoints: 0.175, 0.885, 0.32, 1.275)
public static let easeInOutBack = TimingFunction(name: "easeInOutBack", controlPoints: 0.68, -0.55, 0.265, 1.55)
+ #endif
}
diff --git a/Sica/Source/Transition.swift b/Sica/Source/Transition.swift
index 2408ad0..cc30d93 100644
--- a/Sica/Source/Transition.swift
+++ b/Sica/Source/Transition.swift
@@ -9,19 +9,37 @@
import QuartzCore
public struct Transition {
+ #if swift(>=4.2)
+ typealias RawValue = CATransitionType
+ public static let fade = Transition(rawValue: .fade)
+ public static let moveIn = Transition(rawValue: .moveIn)
+ public static let push = Transition(rawValue: .push)
+ public static let reveal = Transition(rawValue: .reveal)
+ #else
+ typealias RawValue = String
public static let fade = Transition(rawValue: kCATransitionFade)
public static let moveIn = Transition(rawValue: kCATransitionMoveIn)
public static let push = Transition(rawValue: kCATransitionPush)
public static let reveal = Transition(rawValue: kCATransitionReveal)
+ #endif
- let rawValue: String
+ let rawValue: RawValue
}
public struct TransitionSub {
+ #if swift(>=4.2)
+ typealias RawValue = CATransitionSubtype
+ public static let right = TransitionSub(rawValue: .fromRight)
+ public static let left = TransitionSub(rawValue: .fromLeft)
+ public static let top = TransitionSub(rawValue: .fromTop)
+ public static let bottom = TransitionSub(rawValue: .fromBottom)
+ #else
+ typealias RawValue = String
public static let right = TransitionSub(rawValue: kCATransitionFromRight)
public static let left = TransitionSub(rawValue: kCATransitionFromLeft)
public static let top = TransitionSub(rawValue: kCATransitionFromTop)
public static let bottom = TransitionSub(rawValue: kCATransitionFromBottom)
+ #endif
- let rawValue: String
+ let rawValue: RawValue
}