Post

Replies

Boosts

Views

Activity

Comment on App crashes after deleting list item from CoreData - no debug output
Many thanks for your comments, @DelawareMathGuy. It will take me some time to absorb them and experiment with different approaches. I have tried changing the target to iOS 16 and using the new NavigationStack approach which effectively defers the creation of the CourseDetailView until the navigation link is activated (thank heavens!!) and therefore rules out the possibility of a reference to a Course being held by its ViewModel if the detail view hasn't been used before deletion.
Sep ’22
Comment on App crashes after deleting list item from CoreData - no debug output
@DelawareMathGuy, looking closer at the ForEach loop in my code I can certainly see a potential problem in the way the NavigationLink creates the CourseEditView with a strong reference to the later deleted course and would explain why my simplified test code above works OK. Not sure how to refactor this but is this a case which might be solved by the new NavigationStack view in iOS16?
Sep ’22
Comment on App crashes after deleting list item from CoreData - no debug output
@DelawareMathGuy, unfortunately it's not on GitHub and, at this stage I don't want to make the whole app public. I have posted the code for CourseEditView and CourseEditViewModel in a new post below. The entity Course only has 2 properties (id: UUID and name:String) both are set on creation in view model's saveChanges() function which is called whenever the name property changes and the isValid property of the view model is true.
Sep ’22