Reputation: 15945
I'm just trying XCode 6.3 beta and Swift 1.2
What is the meaning of the as!
here?
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == signUpViewId {
var signUpView = segue.destinationViewController as! SignUpViewController
}
}
Upvotes: 2
Views: 213
Reputation: 12045
It means, that if segue.destinationViewController
is a SignUpViewController
, it will cast it to a SignUpViewController
, otherwise it will produce a runtime error.
But if you would use as?
, that case if segue.destinationViewController
is NOT a SignUpViewController
, it would be just nil, without runtime error.
Upvotes: 3