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

fix: make it work on swift4.2 #7

Open
wants to merge 1 commit 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
4 changes: 2 additions & 2 deletions Animo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
Expand All @@ -536,7 +536,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 4.2;
};
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))
}
}
}
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