I created a test project in ios 8 beta 4 which as a main view controller and a second view controller created as a UIViewController subclass with a xib file.
I put a button on the main controller to present the second controller:
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
@IBAction func testVCBtnTapped() {
let vc = TestVC()
presentViewController(vc, animated: true, completion: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
I run the app and pressing the button presents the second controller - all is well
Moving to xcode beta 5, I run the app and when I press the button the screen goes black.
Since I know they messed with the init code, I tried putting in overrides to see it that would fix it:
class TestVC: UIViewController {
override init() {
super.init()
}
required init(coder aDecoder: NSCoder!) {
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
Same problem. Changing the required and overrides in to all possible combinations accepted by xcode has no effect.
If I use the storyboard to create another controller and segue to it all is well.
Any ideas?
EDIT - New info
- Tried nibName = nil in init - same problem
- Created the same app in objective c and it works fine
Apparently a swift beta 5 problem