I\'ve read Using XCode storyboard to instantiate view controller that uses XIB for its design but I\'m having troubles making this work in Swift (Using Xcode 6 Beta 6). I\'m
Another answer is:
override func loadView() {
if #available(iOS 9, *) {
super.loadView()
} else {
let classString = String(self.dynamicType)
NSBundle.mainBundle().loadNibNamed(classString, owner: self, options: nil)
}
}
link: http://japko.net/2014/09/08/loading-swift-uiviewcontroller-from-xib-in-storyboard/
EDIT:
override var nibName: String? {
get {
let classString = String(self.dynamicType)
return classString
}
}
override var nibBundle: NSBundle? {
get {
return NSBundle.mainBundle()
}
}
This looks more beautiful. Works on iOS 8/9 (maybe on iOS 7 too, who knows...))