SwiftUI Table multiple section bug in iPadOS 18 and mac Catalyst

Hi all,

Before updating to iPadOS 18, the Table component in SwiftUI worked as expected, allowing multiple selections using the Shift key and mouse clicks.

However, after the update, this functionality no longer works on iPadOS 18 and macOS 15 (running with Catalyst).

Here’s a simplified version of the code:

@State var selections: Set<String> = []
var body: some View {
  Table(devices, selection: $selections) {
    // ...
  }
}

Is there any workaround for this issue, or has anyone else encountered the same problem?

Thanks!

Answered by Marcus Wu in 812378022

After some attempts, I used

Table(devices, selection: $selections) {
  // ...
}
.environment(\.editMode, .constant(.active))

to force the table into edit mode, which enables multi-selection. However, this adds extra padding to the header. Since there are no customization options available, I can't remove this padding.

I'd greatly appreciate it if you could open a bug report, include a test project and steps to reproduce the issue. Post the FB number here once you do. Bug Reporting: How and Why? has tips on creating your bug report.

Done, the issue number is FB15280607

Accepted Answer

After some attempts, I used

Table(devices, selection: $selections) {
  // ...
}
.environment(\.editMode, .constant(.active))

to force the table into edit mode, which enables multi-selection. However, this adds extra padding to the header. Since there are no customization options available, I can't remove this padding.

SwiftUI Table multiple section bug in iPadOS 18 and mac Catalyst
 
 
Q