SwiftUI Advent Calendar Open

iPhone Duo SwiftUI examples

Explore SwiftUI APIs, components, and modifiers on iPhone Duo. Compare portrait and landscape layouts in closed, partially open, and fully open states, with Swift code and Apple documentation.

View

Dialog Icon

Configures the icon used by dialogs within this view. On macOS, this icon replaces the default icon of the app. On watchOS, this icon will be shown in any dialogs presented. This modifier has no effect on other platforms.

Explore Dialog Icon on iPhone Duo in portrait and landscape across closed, partially open, and fully open states, with SwiftUI code and Apple API 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 iPhone Duo screenshot for Dialog Icon.

6 views