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.
Update interface with snapshot
From the course: Apple watchOS App Development: Advanced APIs
Update interface with snapshot
- [Instructor] I've been avoiding updating the user interface for a reason. You do that in a special process called the snapshot. Snapshots have two critical uses you don't get elsewhere: Updating the image on the dock; and updating the launch image. Notice that when we launched our app, an older version appeared in the background. That's a snapshot. The scheduling of an immediate snapshot is easy. In setTaskCompletedWithSnapshot, change false to true. So we go down in your code, and here, in setTaskCompletedWithSnapshot, that goes to true. As soon as the system can find the time, the snapshot will update. The case in handle, underneath background refresh, is the snapshotTask handler. I'll change the UI here. So far, I've been changing visible interface controller, but I'll use this as an opportunity to change the root controller, instead. Often, you'll want the root controller as the snapshot. So in snapshotTask here, I'm going to go ahead and add the root controller. So I'm going to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
Frontmost app state4m 24s
-
(Locked)
The dock and the background states5m 15s
-
(Locked)
The extension delegate7m 25s
-
(Locked)
Challenge: A background app27s
-
(Locked)
Solution: A background app2m 38s
-
Refresh app in the background6m 57s
-
(Locked)
userInfo in background apps7m 48s
-
(Locked)
Update interface with snapshot8m 16s
-
(Locked)
Default snapshots4m 54s
-
(Locked)
-
-
-
-