Presenting a Single Day Entry

A single day entry is composed of the outside duration and the first character of the weekday. In this section we’ll build a SwiftUI view that shows a rectangle representing the duration relative to the maximum outside duration in the seven-day period. To start, add a new SwiftUI view using the shortcut N, select the SwiftUI View template, and click Next. Save the file as DayEntryView.

The day entry view needs the duration for that day, the maximum duration for the shown period, and the weekday. Add the following properties to DayEntryView:

 struct​ ​DayEntryView​: ​View​ {
 
»let​ duration: ​TimeInterval
»let​ max: ​TimeInterval
»let​ weekday: ​String ...

Get Build Location-Based Projects for iOS 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.