Action Sheet
struct ContentView: View {
@State private var sheetPresented = false
var body: some View {
Button(action: {
self.sheetPresented = true
}) {
Text("Show Action Sheet")
}
.actionSheet(isPresented: $sheetPresented) {
ActionSheet(title: Text("Action Sheet Title"), message: nil, buttons: [
.default(Text("1st option"), action: {
// 1st option action
}),
.default(Text("2nd option"), action: {
// 2nd option action
}),
.destructive(Text("destructive option"), action: {
// destructive option action
}),
.cancel(Text("cancel btn"), action: {
// cancel
})
])
}
}
}

ActionSheet
'in görünmesini istediğimiz zaman ilgili Binding<Bool>
değerini (örnekte sheetPresented
) true yapmamız yeterli olacaktır.
Last updated
Was this helpful?