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

Update interface with snapshot

From the course: Apple watchOS App Development: Advanced APIs

Start my 1-month free trial

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…

Contents