SwiftUI Inspector ideal width

Should this not set the inspector width to 550 every time?

TableView()
    .inspector(isPresented: $state.presented) {
        InspectorFormView(selection: model[state.selection])
            .inspectorColumnWidth(min: 150, ideal: 550, max: 600)
    }

This is almost verbatim from the WWDC video (10161).

This ideal parameter will be the size of the column at at first launch, but if the user resizes the inspector, the system will persist that size across launches.

Inspector uses the minimum width (150) in every case.

How can the ideal width be guaranteed upon initial launch? I could set the minimum to 550, but I'd like the user to be able to reduce the size of the inspector as well ...

Thanks much & keep inspecting!🧐

(Sonoma, beta 5 / Xcode beta 6)

In SwiftUI, the inspectorColumnWidth modifier is meant to control the width of an inspector column within a TableView. The ideal parameter of this modifier should set the initial width of the inspector column, and the system should remember the user-adjusted width for subsequent launches. However, in the beta version of SwiftUI you're using, it seems that the ideal width might not be respected on initial launch.

Workarounds: While waiting for potential updates or bug fixes from Apple, here are a few workarounds you can consider to achieve your desired behavior:

  1. Set Minimum Width to Ideal Width: Since you want to guarantee the initial width while allowing users to reduce the width, you can set the minimum width to the same value as the ideal width. This way, users won't be able to resize the inspector column to a width smaller than the ideal width. This could be a suitable approach if you're okay with users having a fixed minimum width of 550.

    TableView()
        .inspector(isPresented: $state.presented) {
            InspectorFormView(selection: model[state.selection])
                .inspectorColumnWidth(min: 550, ideal: 550, max: 600)
        }
    
  2. Use a Different Layout: Depending on the complexity of your interface, you might consider alternative layouts that don't rely heavily on the inspector column width. This could involve rethinking the arrangement of your UI components or using different SwiftUI layout components that provide more flexible ways to manage widths.

SwiftUI Inspector ideal width
 
 
Q