Complete the code to animate the change of a view's background color.
UIView.animate(withDuration: 1.0) { self.view.backgroundColor = [1] }
The correct way to animate the background color change is to set self.view.backgroundColor inside the animation block to a new color like UIColor.red.
Complete the code to animate the change of a view's alpha property.
UIView.animate(withDuration: 0.5) { self.myView.[1] = 0.0 }
The alpha property controls the transparency of a view. Animating it to 0.0 makes the view fade out.
Fix the error in the animation code by completing the missing method call.
UIView.[1](withDuration: 0.3) { self.button.transform = CGAffineTransform(scaleX: 1.5, y: 1.5) }
The correct method to animate changes is UIView.animate(withDuration:). Other options are invalid method names.
Fill both blanks to animate a view's frame change with a spring effect.
UIView.[1](withDuration: 0.5, delay: 0, usingSpringWithDamping: [2], initialSpringVelocity: 0, options: [], animations: { self.box.frame = CGRect(x: 50, y: 50, width: 100, height: 100) }, completion: nil)
The method animate(withDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:) is used for spring animations. The damping value should be between 0 and 1; 0.5 creates a nice spring effect.
Fill all three blanks to animate a view's background color and alpha change together.
UIView.[1](withDuration: 1.0, animations: { self.cardView.backgroundColor = [2] self.cardView.[3] = 0.5 })
Use UIView.animate(withDuration:animations:) to animate multiple property changes. Set backgroundColor to a new UIColor and alpha to change transparency.