The title sums it up. I've tried disconnecting/reconnecting all the IBOutlets. Here's the code on my InterfaceController where I set up the WKInterfaceTable:
func setupLoadingTable () {
self.myTable.setNumberOfRows(1, withRowType:"universalRowID")
for (var i = 0; i<self.myTable.numberOfRows; i++){
var row = self.myTable.rowControllerAtIndex(i) as! UniversalRowView
row.mainTitle.setText("Hello world") //THIS THROWS AN ERROR
}
}
Here's the code for my UniversalRowView which is my custom row class:
import WatchKit
class UniversalRowView: NSObject {
@IBOutlet weak var mainTitle: WKInterfaceLabel!
@IBOutlet weak var subTitle: WKInterfaceLabel!
}
The IBOutlets for the Table is properly connected. The row on Storyboard is set to type UniversalRowView and outlets for both labels are properly connected.
The line:
row.mainTitle.setText("Hello world")
throws the following error: "fatal error: unexpectedly found nil while unwrapping an Optional value"
Also, when I comment that code out, I don't see the stock WKInterfaceLabels on the simulator as they appear on the Storyboard. I feel like this is an error as well but I don't know what to make of it.
Edit: Calling setupLoadingTable() in willActivate()