SwiftUI Form (Grouped) with Table

Hi everyone,

I’m having an issue with a SwiftUI Table inside a Form in a macOS app. When the Form style is set to .grouped, the Table does not resize to the full width of the Form or Sheet. However, when I switch to a .plain style, it resizes correctly.

Here’s a simplified version of my code:

    Section(header: Text("Header")) {
        Table(data) {
            TableColumn("Column 1", value: \.col1)
            TableColumn("Column 2", value: \.col2)
            // Add more columns as needed
        }
        .frame(height: 100)
    }
}
.formStyle(.grouped) // Issue occurs only with this style

Has anyone else experienced this? Any workarounds or suggestions would be greatly appreciated!

Thanks!

I experience the same problem. It seems the default maximum width of the Form view is set. No work around yet.

This is a new behavior in macOS 15. GroupedFormStyle now limits its content width to 600. In macOS 14 and earlier, this wasn't the case.

Unfortunately, I also haven't found a workaround yet and creating a custom FormStyle that mimics .grouped seems almost impossible.

Turns out macOS 15 finally provides some tools to create a custom FormStyle. I've published an example project here:

CustomFormStyle for macOS (on GitHub)

This isn't a drop-in replacement and has some drawbacks, but it may be helpful increating your own FormStyle.

SwiftUI Form (Grouped) with Table
 
 
Q