For instance, there is a property in a view controller
@IBOutlet weak var nameLabel: UILabel!
This property is nil
inside viewWillAppear
and viewDidLoad
, so the app crashes at runtime.
It was working fine in Xcode 6 Beta 4. After I switched to Beta 5, it complained about the controller class does not implement its superclass's required members
. So I added
required init(coder aDecoder: NSCoder!) {
super.init(coder: aDecoder)
}
And that compiler error disappeared. However, the app crashes for unexpectedly found nil while unwrapping an Optional value
because that nameLabel
property is nil
when I try to set its text
.
I read through the release notes and could not figure out how to fix this issue.