是否可以以编程方式调用导航链接?
这是可能的,但现在已弃用。
var link1 = NavigationLink("Link Text", destination: MyView1())
var link1 = NavigationLink("Link Text", destination: MyView2())
//Something like this
Button(action: {
if (option == 1){
self.link1.presented?.value = true
}
else{
self.link2.presented?.value = true
}
}