I just updated my xcode from 6.2 to 6.3.1. The problem is I got a lot of this error message inside my project.
/Users/MNurdin/Documents/iOS/xxxxx/Controllers/Profile/DirectoryTableViewController.swift:31:98: 'AnyObject!' is not convertible to 'ViewController'; did you mean to use 'as!' to force downcast?
One of my code that affected with this error message.
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let viewController = storyBoard.instantiateViewControllerWithIdentifier("LoginView") as! ViewController
self.presentViewController(viewController, animated:true, completion:nil)
After updating to Xcode 6.3, you are now using Swift 1.2
Prior to Swift 1.2, as
was also used for forced conversion.
Swift 1.2 now represents forced conversions with as!
to make it clear that the conversion may fail if you attempt to downcast to a type that doesn’t actually represent the value’s type.
So you have to use as!
instead of as
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With