This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Swift should suggest the remaining cases, | |
// to a novice it is not clear why this does not cover | |
// the full range of values of an Int | |
switch semVersion.major { | |
case 10...: | |
return 6 | |
case ...9: | |
return 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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)) | |
} | |
} |