swiftui中的确认dialog()
#100daysofcode #ios #swift #swiftui

确认基本上是一条警报消息,来自底部

如果您的Instagram用户,我相信您会看到来自底部

的POP

代码和输出如下:

import SwiftUI

struct ContentView: View {
   @State private var showConfirmation = false

    var body: some View{
        Button("Click me") {
            showConfirmation = true
        }
        .confirmationDialog("Value", isPresented: $showConfirmation) {
            Button("Save"){}
            Button("Delete",role: .destructive){}
            Button("cance",role: .cancel){}
        }
    }
}




struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

输出

Image description