Considering Table Input

If you look at the documentation for WKInterfaceTable, you may notice that there is no delegate property nor (seemingly) any way to handle when the user taps your table. Is this some massive oversight of WatchKit? Do you need to search for a cryptic informal protocol in Objective-C? Turns out the answer is no for both questions. When the user interacts with a WKInterfaceTable, those interactions are automatically forwarded to the table’s containing interface controller, much like the responder chain automatically forwards touch events on iOS. Specifically, you want to look at WKInterfaceController’s table(_:didSelectRowAtIndex:) method, which watchOS will call whenever the user taps a row.

In your table, you’ll ...

Get Developing for Apple Watch, 2nd Edition 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.