From the course: Apple watchOS App Development: Advanced APIs

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

The dock and the background states

The dock and the background states

From the course: Apple watchOS App Development: Advanced APIs

Start my 1-month free trial

The dock and the background states

- [Instructor] Your timer's been running for more than two minutes now and let's see what happens to that front-most app state. Tap the crown, and instead of your timer you get the time. Tap the side button on the doc. You'll see your app paused for about a second, then it'll start to count again exactly where it left off when put into the background. Tap on the app, and it's completely active again. Stop the app. You just used a behavior of watch OS that you should know a lot more about how apps appear on the doc. And what state they are in when in the doc. Before I do, I'm going to add a little code introducing you to a class you'll be using a lot. The WK extension. WK extension is used as a singleton WK extension share. This class gives you information about your app. You include in the application state using the property application state. That's an enumeration, so I'll use a switch to show the status on my watch face. With the app stopped, go to the code in the interface…

Contents