Chapter 7WatchKit Extension Lifecycle

By now your watch app is pretty sophisticated. You’re moving between screens, sending data back and forth, and even replacing your entire UI as needed. But what about all of the other code you want to write—running code when the app starts, handling OS events, and the like? On iOS, you’d use your app delegate to handle the app’s lifecycle methods that run when the user starts or leaves the app. The equivalent on watchOS is the extension delegate, a class you’ll implement to handle the lifecycle events of your watch app. TapALap already has an extension delegate; it was created automatically by Xcode when we created the project, but it doesn’t do anything. In this chapter, you’ll implement ...

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.