Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrated both osx and ios targets to Swift 4.2 #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions Animo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "";
Expand Down Expand Up @@ -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";
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -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;
};
Expand All @@ -576,7 +572,6 @@
MACOSX_DEPLOYMENT_TARGET = 10.10;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
};
name = Debug;
};
Expand All @@ -594,7 +589,6 @@
MACOSX_DEPLOYMENT_TARGET = 10.10;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 4.0;
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Animo/Internal/CAAnimation+AnimoInternals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
22 changes: 11 additions & 11 deletions Animo/Internal/Transition+AnimoInternals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
}
10 changes: 5 additions & 5 deletions Animo/KeyframeValueConvertible.swift
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,18 @@ extension NSObject: KeyframeValueConvertible {
var points = Array<CGPoint>(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
}
Expand Down Expand Up @@ -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)
}
}

Expand Down
8 changes: 4 additions & 4 deletions Animo/Options.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
8 changes: 4 additions & 4 deletions Animo/TimingMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down