Swift 2: Expression type is ambiguous without additional context

class Example: NSObject, UIViewControllerAnimatedTransitioning, UIViewControllerTransitioningDelegate {

var aView : UIView!

UIView.animateWithDuration(duration, delay: 0.0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.8, options: nil, animations: {

       self.aView.transform = CGAffineTransformIdentity //This line is throwing the error mentioned in the Title


            }, completion: { finished in
                transitionContext.completeTransition(true)
      })


}

      

This worked in an earlier version of Swift, but in version 2 was unable to figure out why

+3


source to share


1 answer


You just need to change

UIView.animateWithDuration(duration,
  delay: 0.0,
  usingSpringWithDamping: 0.8,
  initialSpringVelocity: 0.8,
  options: nil,
  animations: {

      

from:



UIView.animateWithDuration(duration,
  delay: 0.0,
  usingSpringWithDamping: 0.8,
  initialSpringVelocity: 0.8,
  options: [],
  animations: {

      

There are only "options" for change.

+5


source







All Articles