I'm following Apple's SwiftUI tutorial and currently stuck on this chapter. I'm trying to add a navigation title and toolbar to this View but it isn't showing up for some reason.
Here's my code:
import SwiftUI
struct ScrumsView: View {
let scrums: [DailyScrum]
var body: some View {
NavigationStack {
List(scrums) { scrum in
NavigationLink(destination: Text(scrum.title)) {
CardView(scrum: scrum)
}
.listRowBackground(scrum.theme.mainColor)
}
.navigationTitle("Daily Scrums")
.toolbar {
Button(action: {}) {
Image(systemName: "plus")
}
}
}
}
}
struct ScrumsView_Previews: PreviewProvider {
static var previews: some View {
ScrumsView(scrums: DailyScrum.sampleData)
}
}
And here's the preview I'm getting:
I'm very new to Swift/SwiftUI and not understanding why this isn't working... any help would be appreciated. Thanks in advance
I saw many other people running into similar issues but they had .navigationTitle
and .toolbar
attached to the NavigationStack
instead of the List
so I have tried moving those two modifiers around but nothing has worked.