Post

Replies

Boosts

Views

Activity

Reply to How can I use multiple `.alert` dialog in SwiftUI?
here some example but I do not know how I will add two delete method to one .alert dialog struct AlertInfo: Identifiable { enum AlertType { case one case two } let id: AlertType let title: String let message: String } struct ContentView6: View { // 2 @State private var info: AlertInfo? var body: some View { VStack { Button("Alert 1") { // 3 info = AlertInfo( id: .one, title: "Title 1", message: "Message 1") } Button("Alert 2") { // 4 info = AlertInfo( id: .two, title: "Title 2", message: "Message 2") } } .alert(item: $info, content: { info in // 5 Alert(title: Text(info.title), message: Text(info.message)) }) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’22
Reply to How can I use multiple `.alert` dialog in SwiftUI?
here some example but I do not know how I will add two delete method to one .alert dialog struct AlertInfo: Identifiable { enum AlertType { case one case two } let id: AlertType let title: String let message: String } struct ContentView6: View { // 2 @State private var info: AlertInfo? var body: some View { VStack { Button("Alert 1") { // 3 info = AlertInfo( id: .one, title: "Title 1", message: "Message 1") } Button("Alert 2") { // 4 info = AlertInfo( id: .two, title: "Title 2", message: "Message 2") } } .alert(item: $info, content: { info in // 5 Alert(title: Text(info.title), message: Text(info.message)) }) } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Mar ’22