Skip to content

Trying to use router.showAlert( #46

Answered by nsarno-lucid
jem5519 asked this question in Q&A
Discussion options

You must be logged in to vote

@jem5519 That closure for alert is () -> View. It comes from the native SwiftUI modifier itself (I also don't like how tricky it is to use - thinking about simplifying this in a fure update). However, I think you should be able to do something like this:

@ViewBuilder var alertButtons: some View {
     Button(role: .none, action: {
			
     }, label: {
          Text("Default")
     })
     Button(role: .cancel, action: {
			
     }, label: {
          Text("Cancel")
     })
     Button(role: .destructive, action: {
			
     }, label: {
          Text("Destructive")
     })
}

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jem5519
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants