Presentation modifiers
Define additional views for the view to present under specified conditions.
Overview
Use presentation modifiers to show different kinds of modal presentations, like alerts, popovers, sheets, and confirmation dialogs.
Because SwiftUI is a declarative framework, you don’t call a method at the moment you want to present the modal. Rather, you define how the presentation looks and the condition under which SwiftUI should present it. SwiftUI detects when the condition changes and makes the presentation for you. Because you provide a Binding to the condition that initiates the presentation, SwiftUI can reset the underlying value when the user dismisses the presentation.
For more information about how to use these modifiers, see Modal presentations.
Topics
Alerts
alert(_:isPresented:actions:)alert(_:isPresented:presenting:actions:)alert(isPresented:error:actions:)
Alerts with a message
alert(_:isPresented:actions:message:)alert(_:isPresented:presenting:actions:message:)alert(isPresented:error:actions:message:)
Confirmation dialogs
confirmationDialog(_:isPresented:titleVisibility:actions:)confirmationDialog(_:isPresented:titleVisibility:presenting:actions:)dismissalConfirmationDialog(_:shouldPresent:actions:)
Confirmation dialogs with a message
confirmationDialog(_:isPresented:titleVisibility:actions:message:)confirmationDialog(_:isPresented:titleVisibility:presenting:actions:message:)dismissalConfirmationDialog(_:shouldPresent:actions:message:)
Dialog configuration
dialogIcon(_:)dialogSeverity(_:)dialogSuppressionToggle(isSuppressed:)dialogSuppressionToggle(_:isSuppressed:)
Sheets
sheet(isPresented:onDismiss:content:)sheet(item:onDismiss:content:)fullScreenCover(isPresented:onDismiss:content:)fullScreenCover(item:onDismiss:content:)
Popovers
popover(item:attachmentAnchor:arrowEdge:content:)popover(isPresented:attachmentAnchor:arrowEdge:content:)
Sheet and popover configuration
interactiveDismissDisabled(_:)presentationDetents(_:)presentationDetents(_:selection:)presentationDragIndicator(_:)presentationBackground(_:)presentationBackground(alignment:content:)presentationBackgroundInteraction(_:)presentationCompactAdaptation(horizontal:vertical:)presentationCompactAdaptation(_:)presentationContentInteraction(_:)presentationCornerRadius(_:)presentationSizing(_:)
File exporter
fileExporter(isPresented:document:contentType:defaultFilename:onCompletion:)fileExporter(isPresented:documents:contentType:onCompletion:)fileExporter(isPresented:document:contentTypes:defaultFilename:onCompletion:onCancellation:)fileExporter(isPresented:documents:contentTypes:onCompletion:onCancellation:)fileExporter(isPresented:item:contentTypes:defaultFilename:onCompletion:onCancellation:)fileExporter(isPresented:items:contentTypes:onCompletion:onCancellation:)fileExporterFilenameLabel(_:)
File importer
fileImporter(isPresented:allowedContentTypes:allowsMultipleSelection:onCompletion:)fileImporter(isPresented:allowedContentTypes:onCompletion:)fileImporter(isPresented:allowedContentTypes:allowsMultipleSelection:onCompletion:onCancellation:)
File mover
fileMover(isPresented:file:onCompletion:)fileMover(isPresented:files:onCompletion:)fileMover(isPresented:file:onCompletion:onCancellation:)fileMover(isPresented:files:onCompletion:onCancellation:)
File dialog configuration
fileDialogBrowserOptions(_:)fileDialogConfirmationLabel(_:)fileDialogCustomizationID(_:)fileDialogDefaultDirectory(_:)fileDialogImportsUnresolvedAliases(_:)fileDialogMessage(_:)fileDialogURLEnabled(_:)
Inspectors
Quick look previews
Family Sharing
familyActivityPicker(isPresented:selection:)familyActivityPicker(headerText:footerText:isPresented:selection:)
Live Activities
Apple Music
StoreKit
appStoreOverlay(isPresented:configuration:)manageSubscriptionsSheet(isPresented:)refundRequestSheet(for:isPresented:onDismiss:)offerCodeRedemption(isPresented:onCompletion:)
PhotoKit
photosPicker(isPresented:selection:matching:preferredItemEncoding:)photosPicker(isPresented:selection:matching:preferredItemEncoding:photoLibrary:)photosPicker(isPresented:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:)photosPicker(isPresented:selection:maxSelectionCount:selectionBehavior:matching:preferredItemEncoding:photoLibrary:)photosPickerAccessoryVisibility(_:edges:)photosPickerDisabledCapabilities(_:)photosPickerStyle(_:)