Using NSNumber from NSNotification.userInfo [UIKeyboardAnimationCurveUserInfoKey]
In Objective-C, I would do the following
[UIView animateWithDuration:1.0 delay:0 options:(curveValue.intValue << 16)
Swift won't let me do the same, although the bit-break statement is the same. I would like to get an enum raw value that is equivalent
UIViewAnimationOptionCurveEaseInOut = 0 <16,
UIViewAnimationOptionCurveEaseIn = 1 <16,
UIViewAnimationOptionCurveEaseOut = 2 <16,
UIViewAnimationOptionCurveLinear = 3 <16,
Update
I'm not sure if the approach below fits, it seems to work
var animationCurve : UIViewAnimationOptions = UIViewAnimationOptions.CurveEaseOut info[UIKeyboardAnimationCurveUserInfoKey].getValue(&animationCurve) UIView.animateWithDuration(durationValue.doubleValue, delay: 0, options: animationCurve, animations: {self.navigationController.toolbar.frame = myRect}, completion: nil)
ios swift
Ryan heitner
source share