I not sure what you mean by two chevrons
and I can not as do not know the dataController
etc (too many errors when just putting the code in, However if you do not want the chevron
which is a built behevior for NavigationLink
in List
. You could try a Button
Did this small code to show
struct ContentView: View {
@State private var paths = NavigationPath()
@State private var selectedFilter = false
let yarns = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
let patterns = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
var yarnBody: some View {
List {
ForEach(yarns, id: \.self) { yarn in
Text("Yarn \(yarn)")
}
}
}
var patternBody: some View {
List {
ForEach(patterns, id: \.self) { pattern in
// USE BUTTON INSTEAD OF NAVIGATIONLINK
Button {
paths.append(pattern)
} label: {
Text("Pattern \(pattern)")
}
.buttonStyle(.plain)
}
}
.navigationDestination(for: Int.self) { pattern in
Text("PATTERN \(pattern)")
}
}
var body: some View {
NavigationStack(path: $paths) {
if selectedFilter {
yarnBody
} else {
patternBody
}
}
}
}