Completing the Journal Entry Detail screen
You now have a SwiftUI map view displaying a map. Now, you’ll create a new SwiftUI view to represent the Journal Entry Detail screen and add the map view to it. Follow these steps:
- Choose File | New | File to open the template selector.
- iOS should already be selected. In the User Interface section, click SwiftUI View and click Next.
- Name the new file
JournalEntryDetail
and click Create. TheJournalEntryDetail
file appears in the Project navigator. - Declare and define the
JournalEntryDetail
structure in this file as shown here:import SwiftUI struct JournalEntryDetail: View { var selectedJournalEntry: JournalEntry var body: some View { ScrollView { VStack{ Spacer().frame(height: 30) Text(selectedJournalEntry.date.formatted(.dateTime.day() .month().year())) .font(.title) .fontWeight(.bold) .frame(maxWidth: .infinity, alignment: .trailing...