That does work as far as the display goes, but unfortunately I need the data in the array to be updated as well (the string array I'm looking to delete from is stored in Core Data, so I want to update the database when changes are made).
Post
Replies
Boosts
Views
Activity
The strings in array are updated by user input. You just need to manage deleted entries. Sorry I meant updated in general, I want to update the array when the user makes any change: editing, reordering, adding or removing elements. For that to work I'd have to track deletes somehow and think about how that might be impacted by inserts and reordering as well, which seems messy and introduces lots of potential problems.
I found a thread on Stack Overflow - https://stackoverflow.com/questions/61434129/swiftui-deleting-last-row-in-foreach/61435489#61435489 which I think is closer to what I was hoping for, and so far appears to be working.
ForEach (0..<array.count, id: \.self) { index in
TextEditor(text: Binding( // << use proxy binding !!
get: { array[index] },
set: { array[index] = $0 }))
}
.onDelete { indexSet in
array.remove(atOffsets: indexSet)
}
I just had this issue pop up yesterday, had them install an older build and then reinstall the latest and so far that's working.
Xcode 14.3 Beta, still an issue
@mostlygeek thanks the solution using Introspect worked for the project I'm working on
Update: After a bunch of back and fourth with the App Store, they finally released the app, so I guess it's correct enough.