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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.