Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Tested on iOS 16.0 / Xcode 14.0 App Store version
- Description:
- When using a NavigationSplitView with multiple selection, the view sometimes selects previously selected items and thereby unexpectedly activates detail views.
- Code Sample:
- struct ContentView: View {
- @State private var selectedItems: Set<Int> = .init()
- var body: some View {
- VStack {
- NavigationSplitView {
- List(0..<10, selection: $selectedItems) { i in
- Text("Item \(i)")
- }
- .navigationTitle("Root")
- .toolbar {
- ToolbarItem(placement: .navigationBarTrailing) {
- EditButton()
- }
- }
- } detail: {
- Text("Detail \(String(describing: selectedItems))")
- .navigationTitle("Detail")
- }
- Text("Selected Items: \(String(describing: selectedItems))")
- }
- }
- }
- Steps to reproduce (using the above code sample):
- - Run the app on an iPhone or in the iPhone Simulator
- - Select an arbitrary item (let's say Item 2)
- - Go back to the root view
- - Tap the Edit button
- - Select at least one item
- - Without deselecting the item, tap the Done button
- - The app will present the detail view for Item 2 without the user tapping on it
- Expected Behavior:
- I expected the app to not activate any detail views, as the user did not tap any items and no detail views were visible before entering edit mode.
- Actual Behavior:
- The app activated a previously active detail view.
- The bug occurs independent of the device and also occurs in the Simulator.
- I verified it on my iPhone 13 running the public release of iOS 16.0 and observed the same behaviour.
- I also attached a screen recording of the bug in the simulator.
Advertisement
Add Comment
Please, Sign In to add comment