Declaration
compose().inspector({
isPresented: Binding<boolean>,
content: ReactNode,
})nonisolated func inspector<V>(
isPresented: Binding<Bool>,
@ContentBuilder content: () -> V
) -> some View
where V : ViewParameters
options.isPresented*Binding<boolean>A binding to
Boolcontrolling the presented state.options.content*ReactNodeThe inspector content.
Discussion
Apply this modifier to declare an inspector with a context-dependent presentation. For example, an inspector can present as a trailing column in a horizontally regular size class, but adapt to a sheet in a horizontally compact size class.
struct ShapeEditor: View {
@State private var presented: Bool = false
var body: some View {
MyEditorView()
.inspector(isPresented: $presented) {
TextTraitsInspectorView()
}
}
}restored by the framework.
- Seealso:
InspectorCommandsfor including the default inspector commands and keyboard shortcuts.
See also
More in Presentation.
- alertPresents an alert when a given condition is true, using a localized string resource for the title.
- confirmationDialogPresents a confirmation dialog when a given condition is true, using a localized string resource for the title.
- contextMenuAdds an item-based context menu to a view.
- dialogIconConfigures the icon used by dialogs within this view.
- dialogSuppressionToggleEnables user suppression of dialogs and alerts presented within self, with a custom suppression message on macOS. Unused on other platforms.
- dismissalConfirmationDialogPresents a confirmation dialog upon an attempt to dismiss the window for this view.
- documentBrowserContextMenuAdds to a DocumentLaunchView actions that accept a list of selected files as their parameter.
- fileDialogBrowserOptionsOn macOS, configures the fileExporter, fileImporter, or fileMover to provide a refined URL search experience: include or exclude hidden files, allow searching by tag, etc.
- fileDialogConfirmationLabelOn macOS, configures the fileExporter, fileImporter, or fileMover with a custom confirmation button label.
- fileDialogCustomizationIDOn macOS, configures the fileExporter, fileImporter, or fileMover to persist and restore the file dialog configuration.
- fileDialogDefaultDirectoryConfigures the fileExporter, fileImporter, or fileMover to open with the specified default directory.
- fileDialogImportsUnresolvedAliasesOn macOS, configures the fileExporter, fileImporter, or fileMover behavior when a user chooses an alias.