Why do you have to tap twice to deselect "Item 1"? Am I doing something wrong? If not, is there a workaround? It happens both in the simulator and on my iPhone.
Steps:
- Tap "Item 1". Nothing happens. Do not tap another item first. Also, it only happens once so restart the app to retry.
- Tap "Item 1" again. It is deselected.
import SwiftUI
struct ContentView: View {
@State private var selectedItems: Set<Int> = [1]
var body: some View {
NavigationView { // Some apparent solutions do not work inside a NavigationView
List(selection: $selectedItems) {
Text("Item 1").tag(1)
Text("Item 2").tag(2)
Text("Item 3").tag(3)
}.environment(\.editMode, Binding.constant(EditMode.active))
}
}
}