Post

Replies

Boosts

Views

Activity

SwiftUI .onDelete not working on WatchOS
I'm building a standalone WatchOS app. I have tried implementing the .onDelete modifier to easily delete items in a list, and I get no warnings or errors in XCode. But swiping, both in the simulator and Live Preview, does not do anything. This is tested both in XCode 11.6 with WatchOS 6.2, and XCode 12.0 beta 2 with WatchOS 7. Am I missing something here? Minimal example: struct ContentView: View {     @State var names = ["Alpha", "Bravo", "Charlie", "Delta"]     var body: some View {         ScrollView {             ForEach(names, id: \.self) { name in                 Button(action: {}) {                     Text(name)                 }             }.onDelete(perform: deleteItems)         }             }     private func deleteItems(at offsets: IndexSet) {         names.remove(atOffsets: offsets)     } }
4
0
2.5k
Jul ’20