Why cam I getting the Cannot convert value of type [AnyObject]! to expected argument type. I am trying to load a nib into a view controller.
func loadNibNamed(name: String!, owner: AnyObject!, options: [NSObject : AnyObject]!) -> [View1]!{
NSBundle.mainBundle(loadNibNamed("View1", owner: self, options: nil)).lastObject
}
I think this is right code in Swift2.0
NSBundle.mainBundle().loadNibNamed("View1", owner: self, options: nil).last
lastObject is for Swift1.2 and now it isn't available in swift2.0 use last instead.
And to use it , you can convert it into UIView.