Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save christopherweems/4b2fd4ffd9983a1d77b8 to your computer and use it in GitHub Desktop.
Save christopherweems/4b2fd4ffd9983a1d77b8 to your computer and use it in GitHub Desktop.
Convert from UIViewAnimationCurve to UIViewAnimationCurveOptions
// Simple function converting from UIViewAnimationCurve to UIViewAnimationCurveOptions
// Not all UIViewAnimationCurve values have a specified equivalent UIViewAnimationCurveOptions,
// making it tricky to use the animation curve of the keyboard with UIView.animateWithDuration(...) API.
// This works as late as iOS 9.1, but could change in the future.
extension UIViewAnimationCurve {
func toOptions() -> UIViewAnimationOptions {
return UIViewAnimationOptions(rawValue: UInt(rawValue << 16))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment