From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 23,200 courses taught by industry experts.

TimelineView

TimelineView

- [Instructor] SwiftUI is built to refresh the user interface at user events, but you'll find timed events are sometimes necessary to refresh views. In iOS 15, SwiftUI gains the timeline view, which makes working with timed events very easy. Now I've put together the basics of a clock app for you to show you how this works. I'll make a digital clock on top over here, where the demo sign is, and we've got some lines down here for an analog one, which are the different hands. I've already written for you the WatchHand view here that will help you set that up properly, so all we have to do is get them to work right. I'm going to go back here to ContentView and I'll show you how to put in the timeline view. They are really simple. You start by just typing in TimelineView. They take one parameter, which is the timeline schedule. Now there's lots of different ways to get a schedule, but one that you'll use a lot is going to…

Contents