Skip to content

Commit

Permalink
Merge pull request #3 from marty-suzuki/xcode-10
Browse files Browse the repository at this point in the history
Support Xcode10
  • Loading branch information
marty-suzuki committed Sep 26, 2018
2 parents 63bbb04 + 21d2ba0 commit 4bbc96a
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 32 deletions.
9 changes: 7 additions & 2 deletions Example/TheAnimationExample-iOS/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ import UIKit
@UIApplicationMain
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 {

return true
}
Expand Down
5 changes: 3 additions & 2 deletions Example/TheAnimationExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@
};
3724DDD020A6CA3200584B56 = {
CreatedOnToolsVersion = 9.3;
LastSwiftMigration = 1000;
};
};
};
Expand Down Expand Up @@ -553,7 +554,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.TheAnimationExample-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -571,7 +572,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.TheAnimationExample-iOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<p align="center">
<img src="http://img.shields.io/badge/platform-iOS | tvOS | macOS-blue.svg?style=flat" alt="Platform" />
<a href="https://developer.apple.com/swift">
<img src="http://img.shields.io/badge/language-Swift-brightgreen.svg?style=flat" alt="Language">
<img src="http://img.shields.io/badge/Swift-4.1%20|%204.2-brightgreen.svg?style=flat" alt="Language">
</a>
<a href="https://github.com/Carthage/Carthage">
<img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" alt="Carthage">
Expand Down Expand Up @@ -86,6 +86,7 @@ extension AnimationKeyPaths {
- iOS 9 or greater
- tvOS 9 or greater
- macOS 10.11 or greater
- Swift 4.2 (since 0.3.0)

## Installation

Expand Down
10 changes: 1 addition & 9 deletions TheAnimation.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'TheAnimation'
s.version = '0.2.1'
s.version = '0.3.0'
s.summary = 'Type safe CAAnimation wrapper.'

# This description is used to generate tags and improve search results.
Expand All @@ -33,12 +33,4 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '9.0'

s.source_files = 'TheAnimation/**/*.{swift}'

# s.resource_bundles = {
# 'TheAnimation' => ['TheAnimation/Assets/*.png']
# }

# s.public_header_files = 'Pod/Classes/**/*.h'
# s.frameworks = 'UIKit', 'MapKit'
# s.dependency 'AFNetworking', '~> 2.3'
end
17 changes: 9 additions & 8 deletions TheAnimation.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0930;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "marty-suzuki";
TargetAttributes = {
0746D5C420B5AE6600D21053 = {
Expand All @@ -296,10 +296,11 @@
};
37BD759720A5D050009219F2 = {
CreatedOnToolsVersion = 9.3;
LastSwiftMigration = 0930;
LastSwiftMigration = 1000;
};
37BD75A020A5D050009219F2 = {
CreatedOnToolsVersion = 9.3;
LastSwiftMigration = 1000;
};
};
};
Expand Down Expand Up @@ -433,7 +434,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
Expand Down Expand Up @@ -464,7 +465,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Mac Developer";
CODE_SIGN_IDENTITY = "";
CODE_SIGN_STYLE = Manual;
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
Expand Down Expand Up @@ -688,7 +689,7 @@
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand Down Expand Up @@ -716,7 +717,7 @@
PRODUCT_NAME = TheAnimation;
PROVISIONING_PROFILE_SPECIFIER = "";
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand All @@ -736,7 +737,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.TheAnimationTests";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
Expand All @@ -756,7 +757,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "jp.marty-suzuki.TheAnimationTests";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
12 changes: 11 additions & 1 deletion TheAnimation/Source/Animation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,22 @@ extension Animation {
}

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: String
let rawValue: RawValue
}

public struct AnimationCanceller {
Expand Down
23 changes: 21 additions & 2 deletions TheAnimation/Source/KeyframeAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,37 @@ extension PrimitiveAnimation where RawAnimation == CAKeyframeAnimation {


public struct CalculationMode {

#if swift(>=4.2)
typealias RawValue = CAAnimationCalculationMode
public static let linear = CalculationMode(rawValue: .linear)
public static let discrete = CalculationMode(rawValue: .discrete)
public static let paced = CalculationMode(rawValue: .paced)
public static let cubic = CalculationMode(rawValue: .cubic)
public static let cubicPaced = CalculationMode(rawValue: .cubicPaced)
#else
typealias RawValue = String
public static let linear = CalculationMode(rawValue: kCAAnimationLinear)
public static let discrete = CalculationMode(rawValue: kCAAnimationDiscrete)
public static let paced = CalculationMode(rawValue: kCAAnimationPaced)
public static let cubic = CalculationMode(rawValue: kCAAnimationCubic)
public static let cubicPaced = CalculationMode(rawValue: kCAAnimationCubicPaced)
#endif

let rawValue: String
let rawValue: RawValue
}

public struct RotationMode {

#if swift(>=4.2)
typealias RawValue = CAAnimationRotationMode
public static let auto = RotationMode(rawValue: .rotateAuto)
public static let autoaReverse = RotationMode(rawValue: .rotateAutoReverse)
#else
typealias RawValue = String
public static let auto = RotationMode(rawValue: kCAAnimationRotateAuto)
public static let autoaReverse = RotationMode(rawValue: kCAAnimationRotateAutoReverse)
#endif

let rawValue: String
let rawValue: RawValue
}
19 changes: 18 additions & 1 deletion TheAnimation/Source/PropertyAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ extension PrimitiveAnimation where RawAnimation: CAPropertyAnimation {
}

public struct ValueFunction {

#if swift(>=4.2)
typealias RawValue = CAValueFunctionName
public static let rotateX = ValueFunction(name: .rotateX)
public static let rotateY = ValueFunction(name: .rotateY)
public static let rotateZ = ValueFunction(name: .rotateZ)
public static let scale = ValueFunction(name: .scale)
public static let scaleX = ValueFunction(name: .scaleX)
public static let scaleY = ValueFunction(name: .scaleY)
public static let scaleZ = ValueFunction(name: .scaleZ)
public static let translate = ValueFunction(name: .translate)
public static let translateX = ValueFunction(name: .translateX)
public static let translateY = ValueFunction(name: .translateY)
public static let translateZ = ValueFunction(name: .translateZ)
#else
typealias RawValue = String
public static let rotateX = ValueFunction(name: kCAValueFunctionRotateX)
public static let rotateY = ValueFunction(name: kCAValueFunctionRotateY)
public static let rotateZ = ValueFunction(name: kCAValueFunctionRotateZ)
Expand All @@ -39,10 +55,11 @@ public struct ValueFunction {
public static let translateX = ValueFunction(name: kCAValueFunctionTranslateX)
public static let translateY = ValueFunction(name: kCAValueFunctionTranslateY)
public static let translateZ = ValueFunction(name: kCAValueFunctionTranslateZ)
#endif

let rawValue: CAValueFunction?

init(name: String) {
init(name: RawValue) {
self.rawValue = CAValueFunction(name: name)
}

Expand Down
13 changes: 12 additions & 1 deletion TheAnimation/Source/TimingFunction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,26 @@
import QuartzCore.CoreAnimation

public struct TimingFunction {

#if swift(>=4.2)
typealias RawValue = CAMediaTimingFunctionName
public static let `default` = TimingFunction(name: .default)
public static let linear = TimingFunction(name: .linear)
public static let easeIn = TimingFunction(name: .easeIn)
public static let easeOut = TimingFunction(name: .easeOut)
public static let easeInEaseOut = TimingFunction(name: .easeInEaseOut)
#else
typealias RawValue = 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

let rawValue: CAMediaTimingFunction

init(name: String) {
init(name: RawValue) {
self.rawValue = CAMediaTimingFunction(name: name)
}

Expand Down
24 changes: 22 additions & 2 deletions TheAnimation/Source/TransitionAnimation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,39 @@ public final class TransitionAnimation: Animation {
}

public struct TransitionType {

#if swift(>=4.2)
typealias RawValue = CATransitionType
public static let fade = TransitionType(rawValue: .fade)
public static let moveIn = TransitionType(rawValue: .moveIn)
public static let push = TransitionType(rawValue: .push)
public static let reveal = TransitionType(rawValue: .reveal)
#else
typealias RawValue = String
public static let fade = TransitionType(rawValue: kCATransitionFade)
public static let moveIn = TransitionType(rawValue: kCATransitionMoveIn)
public static let push = TransitionType(rawValue: kCATransitionPush)
public static let reveal = TransitionType(rawValue: kCATransitionReveal)
#endif

let rawValue: String
let rawValue: RawValue
}

public struct TransitionSubtype {

#if swift(>=4.2)
typealias RawValue = CATransitionSubtype
public static let right = TransitionSubtype(rawValue: .fromRight)
public static let left = TransitionSubtype(rawValue: .fromLeft)
public static let top = TransitionSubtype(rawValue: .fromTop)
public static let bottom = TransitionSubtype(rawValue: .fromBottom)
#else
typealias RawValue = String
public static let right = TransitionSubtype(rawValue: kCATransitionFromRight)
public static let left = TransitionSubtype(rawValue: kCATransitionFromLeft)
public static let top = TransitionSubtype(rawValue: kCATransitionFromTop)
public static let bottom = TransitionSubtype(rawValue: kCATransitionFromBottom)
#endif

let rawValue: String
let rawValue: RawValue
}

0 comments on commit 4bbc96a

Please sign in to comment.