Using swift 3 The application starts with an empty table The user adds the data
ID: 3868399 • Letter: U
Question
Using swift 3
The application starts with an empty table The user adds the data in the table via a text box The user can remove any data that has been added in the table When you press any line, its background is colored Example: When you press the second line, its background becomes red When you press the third line, the second line background becomes white and the third line is red And so on 3- When you close the application completely and restart it again (After deleting it from the multi-task bar) All data appears as it was Including the background coloring of the last compressed lineExplanation / Answer
When you are saving your managed data and coloring information, the UserDefaults saves the changes in the parent context, but it doesn't mean that they are saved into the Disk.
And thus, on restarting the application, all the data appears as it was, as it has never been deleted from the persistent store, you can see it in App Delegates in applicationWillTerminate.
You have to save the Managed Object Context(MOC) of parent context to the persistent store to make the deletion permanent.
You can use something like:
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.