antzcrashing

u/antzcrashing







r/iOSProgramming•

In short I am doing a core data app which creates and displays departments and employees with the simple relationship, a department may have many employees. I display departments as a view in stack with the employee info displayed below each department, so a basic example is:

department: Apple

employee: John

employee: Sarah

department: Microsoft

employee: Michael

employee: Rachel

When I use the onDelete function, it works as expected for the entity that I iterate the foreach on within the list, which is good. But when I attempt to delete an employee via the swipe-delete action, it attempts to delete the department with the index of the employee, i.e. deleting Sarah (index:1) in the

21

r/iOSProgramming•

I have an array of structs (identifiable), and I would like to find the struct which contains an element (string type) which matches a string. Please suggest a good clean way to do this. I expected the findIndex function operating on the array to be what I want, but I can’t get it to take - error reading: “argument type string expected to be an instance of a class or class-constrained type”. Thank you

36

r/swift•

I have created a simple core data project with two related entities. I have a simple app that displays them in a stack within a view. I can add the top level entity and delete them, with the .removeAll function, and they properly clear, but frustratingly, when I go to add another top level entity, the previous ones fill the view, it’s as if nothing is actually getting deleted. I want to have a way to fully clear the database for certain entities. It would be best if I can do this from the app itself, but I would even settle for being able to do it from Xcode. Also, is there a good way in Xcode to display my core data database entries as a sanity check? Thank you

14