I am new to SwiftUI framework I am trying to implement NavigationStack. I want to navigate on button action instead of using NavigationLink. The reason behind that is, I need to navigate once a particular function get performed on button action.
struct AView: View {
@State private var actionss = [Int]()
var body: some View {
NavigationStack(path: $actionss) {
VStack {
Button("test") {
actionss.append(0)
}
}
.navigationDestination(for: Int.self) { _ in
BView()
}
}
}
}
Above code of "AView" is working fine to navigate "BView". The only thing is I am not able to navigate on "CView" from "BView" without using NavigationLink. I need to perform particular function before navigate from "BView" to "CView" as well.
Please help me in this.