Xcode 6.1: UIView.animateWithDuration Additional argument 'usingSpringWithDamping'

I do not know why the error "Extra argument" usingSpringWithDamping "in the call" unexpectedly appears for the following.

I am just starting, so any help would be appreciated!

    UIView.animateWithDuration(1.0,
        delay: 0,
        usingSpringWithDamping: 1.5,
        initialSpringVelocity: 5.0,
        options: UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.AllowUserInteraction,
        animations: {
            self.view.backgroundColor = newColor
            self.funFactLabel.transform = CGAffineTransformMakeScale(1.25, 1.25)
        }, completion: { finished in
            UIView.animateWithDuration(2.0,
                delay: 0,
                usingSpringWithDamping: 0.5,
                initialSpringVelocity: 5.0,                    
                options: nil,
                animations: {
                    self.funFactLabel.transform = CGAffineTransformMakeScale(1.0, 1.0)
                }
            )}, completion: nil
    )
+4
source share
1 answer

Try the following:

UIView.animateWithDuration(1.0,
    delay: 0,
    usingSpringWithDamping: 1.5,
    initialSpringVelocity: 5.0,
    options: UIViewAnimationOptions.CurveEaseInOut | UIViewAnimationOptions.AllowUserInteraction,
    animations: {
        self.view.backgroundColor = newColor
        self.funFactLabel.transform = CGAffineTransformMakeScale(1.25, 1.25)
    }, completion: { finished in
        UIView.animateWithDuration(2.0,
            delay: 0,
            usingSpringWithDamping: 0.5,
            initialSpringVelocity: 5.0,
            options: nil,
            animations: {
                self.funFactLabel.transform = CGAffineTransformMakeScale(1.0, 1.0)
            } , completion: nil)
    })
+5
source

All Articles