`SwiftUI.Table` Select and Done buttons breaking navigation on iPadOS?

https://github.com/apple/sample-food-truck

Hi! I'm following along with the sample-food-truck application from WWDC 2022. I'm seeing some weird navigation issues when building the app for iPadOS.

The Table component displays a Select Button for selecting elements and a Done Button disabling that state. These buttons seem to be breaking something about navigation on iOS 18.4.1. It's a nondeterministic issue… but tapping the buttons seems to lead to some corrupt state where the app transitions out of OrdersView and back to TruckView.

This code from FoodTruckModel seems to be making a difference:

Task(priority: .background) {
    var generator = OrderGenerator.SeededRandomGenerator(seed: 5)
    for _ in 0..<20 {
        try? await Task.sleep(nanoseconds: .secondsToNanoseconds(.random(in: 3 ... 8, using: &generator)))
        Task { @MainActor in
            withAnimation(.spring(response: 0.4, dampingFraction: 1)) {
                self.orders.append(orderGenerator.generateOrder(number: orders.count + 1, date: .now, generator: &generator))
            }
        }
    }
}

Commenting out that code and disabling the new Order values coming in seems to fix the issue.

Is there any public documentation for me to learn about the Select and Done buttons? I don't see anywhere for me to learn about how these work and what my ability is to customize their behavior.

Any ideas? I can repro from device and simulator.

The Table component displays a Select Button for selecting elements and a Done Button disabling that state. These buttons seem to be breaking something about navigation on iOS 18.4.1. It's a nondeterministic issue… but tapping the buttons seems to lead to some corrupt state where the app transitions out of OrdersView and back to TruckView.

If the find a bug in the sample code please file a big report via Feedback Assistant and post the FB number here once you do. Bug Reporting: How and Why? has tips on creating your bug report.

Is there any public documentation for me to learn about the Select and Done buttons? I don't see anywhere for me to learn about how these work and what my ability is to customize their behavior.

Are you referring to the dismiss environment property? If you are then checkout the API docs on dismiss and DismissAction

If the find a bug in the sample code please file a big report via Feedback Assistant and post the FB number here once you do.

https://appleinsider.com/articles/25/04/18/when-you-report-bugs-on-ios-some-content-may-be-used-for-ai-training

Thanks… but for privacy reasons I'm currently blocked on submitting bug reports due to a requirement on AI training.

Are you referring to the dismiss environment property?

I'm referring to the Select and Done buttons that appear to toggle EditMode:

&#96;SwiftUI.Table&#96; Select and Done buttons breaking navigation on iPadOS?
 
 
Q