Swift & SwiftUI
  • İçerikler
  • UI Bileşenleri
    • Text
    • Button
    • Image
    • Picker
    • SecureField
    • Stepper
    • Slider
    • TabView
    • Sheet
    • Action Sheet
    • Alert
  • Layout
    • Fill-Space-Equally
  • State & Data Flow
    • Content
    • EnvironmentObject
    • ObservableObject
    • ObservedObject
    • Binding
  • Gestures
    • TapGesture
    • DragGesture
    • MagnificationGesture
    • RotationGesture
    • LongPressGesture
    • Notes
  • Extra
    • GeometryReader
    • Timer
    • AlignmentGuide
    • PreferenceKey
  • Concurrency
    • Perform asynchronous operation
Powered by GitBook
On this page

Was this helpful?

  1. UI Bileşenleri

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.

PreviousSheetNextAlert

Last updated 4 years ago

Was this helpful?