I tried to add two NavigationLink in one VStack, but it report a unknown error for me.
struct LoginView: View {
@State private var selector = ""
var body: some View {
NavigationView {
VStack(spacing: 30) { // error `Unable to infer complex closure return type; add explicit type to disambiguate`
NavigationLink(destination: OneView(), tag: "one",
selection: $selector) { EmptyView() }
NavigationLink(destination: TwoView(), tag: "two",
selection: $selector) { EmptyView() }
Button("change to view") {
self.selector = "one"
}
}
.navigationBarTitle("Test Navigation")
}
}
}