I'm trying to make an app using Apple's SwiftUI and I need to have two buttons that present two different views in a single List
row.
I use Xcode beta 7 and MacOS Catalina beta 7. I've tried to add a Button
that present the view but, I couldn't click it and when I tried on a simple Button
outside the List
and clicked it, the AddList()
view didn't appear. I've also tried adding a navigationButton
inside navigationButton
but it didn't work too. Adding a tapAction
doesn't work too when you click on it, the view still does not appear
NavigationView {
List(0..<5) { item in
NavigationLink(destination: ContentOfList()) {
Text("hello") // dummy text
Spacer()
Text("edit")
.tapAction {
AddList() // This is the view I want to present
}
}
}.navigationBarItems(trailing: NavigationLink(destination: AddList(), label: { // doesn't work within navigationBarItems
Image(systemName: "plus.circle.fill")
}))
}
I expect the AddList()
view to appear but in the two cases, it doesn't.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…