UIView.animateWithDuration in Swift 2.0? UIView.animateWithDuration in Swift 2.0? swift swift

UIView.animateWithDuration in Swift 2.0?


You are passing enum of type UIViewAnimationTransition to an argument which requires type UIViewAnimationOptions (options argument)

Here is the correct syntax with the correct enum value:

func moveSideBarToXposition(iXposition: Float) {    let convertedXposition = CGFloat(iXposition)    UIView.animateWithDuration(0.5, delay: 1.0, options: UIViewAnimationOptions.TransitionNone, animations: { () -> Void in        self.contentView.frame = CGRectMake(convertedXposition, 20, self.contentView.frame.size.width, self.contentView.frame.size.height)        }, completion: { (finished: Bool) -> Void in            // you can do this in a shorter, more concise way by setting the value to its opposite, NOT value            isMenuHidden = !isMenuHidden    })}