Skip to content

Instantly share code, notes, and snippets.

@ateliercw
Created April 15, 2016 13:14
Show Gist options
  • Save ateliercw/6182e6bc46924a3ca20075c11349f5ef to your computer and use it in GitHub Desktop.
Save ateliercw/6182e6bc46924a3ca20075c11349f5ef to your computer and use it in GitHub Desktop.
public extension UIViewKeyframeAnimationOptions {
// This exists because keyframe options doesn't expose the easing for the overall curve
public init(keyframeAnimationsOptions: UIViewKeyframeAnimationOptions, animationCurve: UIViewAnimationCurve) {
let animationOptions: UIViewAnimationOptions
switch animationCurve {
case .EaseIn: animationOptions = .CurveEaseIn
case .EaseInOut: animationOptions = .CurveEaseInOut
case .EaseOut: animationOptions = .CurveEaseOut
case .Linear: animationOptions = .CurveLinear
}
self = UIViewKeyframeAnimationOptions(rawValue: keyframeAnimationsOptions.rawValue | animationOptions.rawValue)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment