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.
Platform Compatibility
SwiftUI Code
@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))
}