SwiftUI Advent Calendar Open

iPad SwiftUI layouts

Explore SwiftUI APIs, components, and modifiers with interactive iPad previews, Swift code, and Apple documentation.

@State var isShowingDialog = false

var body: some View {
    Button("FooBar") {
        isShowingDialog = true
    }
    .confirmationDialog(
        "Are you sure you want to do FooBar?",
        isPresented: $isShowingDialog
    ) {
        Button("Foo", role: .destructive, action: action)
        Button("Bar", role: .cancel) {
            isShowingDialog = false
        }
    }
    .dialogIcon(Image(.cats))

}
iOS 17.0+ iPadOS 17.0+ macOS 13.0+ watchOS 10.0+ tvOS 17.0+

Every available iPad screenshot for Dialog Icon.

2 views