我想使用一个NavigationBarItems中的按钮打开一个新视图。我把我的代码。感谢您的帮助。
struct ClienteView: View {
var body: some View {
NavigationView {
List(clientes) { cliente in
NavigationLink(destination: DetallesClienteView(objCliente: cliente)){
DetallesCliente(objCliente: cliente)
}
}
.navigationBarTitle(Text("Clientes"), displayMode: .inline)
.navigationBarItems(trailing:
Button(action: {
}) {
Image(systemName: "person.badge.plus")
}
)
}
}
}
答案 0 :(得分:0)
您可以做这种事情:
.navigationBarItems(trailing:
NavigationLink(destination: SecondView(), label: {
Image(systemName: "person.badge.plus")
})
)