Configuring the Content in Tables

Now that we’ve squared away how our row controller is going to behave, we can use it in our RunLogInterfaceController. Unlike UITableView from UIKit, where we’d return the number of rows from a data source method and then configure each row on demand, we’ll set the number of rows manually, then iterate through them and configure them as we go. We’ll also configure our NSFormatter subclasses to do formatting, then pass them to each row controller. We’ll get everything set up in the interface controller’s willActivate method. First, however, we need the data to put in the rows. Create a new class in Swift. Add a new Swift file to our WatchKit extension, and name it Run.swift. In it, create a new class with some ...

Get Developing for Apple Watch now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.