Settings in animateWithDuration in Swift 2

I am animating a textbox with the following code:

UIView.animateWithDuration(0.5, delay: 0.4,
        options: .Repeat | .Autoreverse | .CurveEaseOut, animations: {
            self.password.center.x += self.view.bounds.width
        }, completion: nil)

      

I am getting the error Could not find member 'Repeat'

The code only works if I only set one parameter. Why doesn't this allow me to set multiple parameters?

+3


source to share


1 answer


The syntax for joining OptionSetType

has changed, you can do it like this:



UIView.animateWithDuration(0.5, delay: 0.4,
    options: [.Repeat, .CurveEaseOut, .Autoreverse], animations: {
        self.password.center.x += self.view.bounds.width
    }, completion: nil)

      

+9


source







All Articles