iosswiftxcode6uiviewanimationxcode7-beta2

Animation code Error: Type of expression is ambiguous without more context


I have typed some simple animation code in Xcode 7 beta 2-

 UIView.animateWithDuration( 0.5, delay: 1, options: nil, animations: ({
        self.W.frame = CGRect(x: 107, y: 268, width: 30, height: 33)
        self.nameLabel.alpha = 0
        self.wd.alpha = 0

    } ), completion:{ finished in
        UIView.animateWithDuration(0.5, animations: ( { ()-> Void in self.wd.alpha = 1 } ), completion: {finished in
            UIView.animateWithDuration(0.5, delay: 1, options: nil, animations: ({()-> Void in
                self.greenLaunchScreenView.alpha = 0
                self.nameLabel.alpha = 0
                self.wd.alpha = 0
                self.W.alpha = 0
                self.launchScreenCircle.alpha = 0
                self.navigationController?.setNavigationBarHidden( false, animated: true )
            }), completion: nil )

            }
        )})

When I type the same code in Xcode 6, it works perfectly, but it doesn't work in Xcode 7 beta 2 as it gives me an error- "Type of expression is ambiguous without more context". How can I make this code work in Xcode 7 beta?


Solution

  • In Xcode 7 (Swift 2), please use [] in place of nil for parameter options: in UIView.animateWithDuration.