inspectorColumnWidth

Sets a fixed, preferred width for the inspector containing this view when presented as a trailing column.

View ModifieriOS 17.0+macOS 14.0+

Overloads

2 ways to call compose().inspectorColumnWidth(). Each is one SwiftUI overload, picked by the arguments you pass.

React
compose().inspectorColumnWidth(width: number)
Swift
nonisolated func inspectorColumnWidth(_ width: CGFloat) -> some View

Parameters

  • width*number

    The preferred fixed width for the inspector if

Discussion

Apply this modifier on the content of a View.inspector(isPresented:content:) to specify a fixed preferred width for the trailing column. Use View.inspectorColumnWidth(min:ideal:max:) if you need to specify a flexible width.

The following example shows an editor interface with an inspector, which when presented as a trailing-column, has a fixed width of 225 points. The example also uses View.interactiveDismissDisabled(_:) to prevent the inspector from being collapsed by user action like dragging a divider.

MyEditorView()
    .inspector {
        TextTraitsInspectorView()
            .inspectorColumnWidth(225)
            .interactiveDismissDisabled()
    }

presented as a trailing column.

inspector on macOS. See View.interactiveDismissDisabled(_:).

See also

More in Presentation.