merkur0
merkur0
TSDThe Swift Den
Created by merkur0 on 7/9/2023 in #swift-development
NavigationStack with path initializer giving me "No exact matches in call to initializer "
My code:
struct ListView: View {
@State private var presentedViews: [DayView] = [DayView(date: "March 23")]

var body: some View {
NavigationStack(path: $presentedViews) { // ERROR: No exact matches in call to initializer
List {
ForEach(items, id: \.self) { item in
NavigationLink(destination: DayView(date: item)) {
Text(item)
}
}
}
}
}
}
struct ListView: View {
@State private var presentedViews: [DayView] = [DayView(date: "March 23")]

var body: some View {
NavigationStack(path: $presentedViews) { // ERROR: No exact matches in call to initializer
List {
ForEach(items, id: \.self) { item in
NavigationLink(destination: DayView(date: item)) {
Text(item)
}
}
}
}
}
}
I'm following Apple's documentation on this (https://discord.com/channels/918166237652062228/1127532878213955615) yet I get this error when I'm (seemingly) doing everything the same. The only difference I can see is that I'm not using the .navigationDestination modifier, but I doubt that that's mandatory as it doesn't state that anywhere. Any ideas? Thanks in advance, I'm stuck on this
1 replies