Alert warning prompt box SwiftUI of control (including demo)
Code
import SwiftUI
struct ContentView: View {
@State var showAlert = false
var body: some View {
NavigationView {
VStack {
Button("Show Alert"){
self.showAlert = true
}.alert(isPresented: $showAlert){
Alert(title: Text("hello"), message: Text("This is our first Alert Message"), dismissButton: .default(Text("OK")))
}
}
.navigationBarTitle(Text("基础控件"))
}
}
}
effect
More attention SwiftUI tutorials and code columns
- Please pay attention to my column SwiftUI tutorials and source code