They say they use NSUserDefaults
When I first introduced the long-term (after closing the application) data warehouse, everything I read on the Internet pointed to NSUserDefaults. However, I wanted to keep the dictionary, and although it was possible, it was painful. I spent hours trying to make errors like disappear.
NSUserDefaults is also limited in function
Further reading showed how reading / writing NSUserDefaults really makes the application read / write all or nothing, all at once, so it is not efficient. Then I found out that getting an array is not so simple. I realized that if you store more than a few lines or booleans, NSUserDefaults is actually not perfect.
It also does not scale. If you are learning to program, learn a scalable way. Use only NSUserDefaults to store simple strings or logical values associated with settings. Storing arrays and other data using Core Data is not as difficult as they say. Just start small.
Update: Also, if you add support for Apple Watch, there is another potential factor. Your NSUserDefaults application is now automatically sent to the Watch extension.
Using master data
So I ignored the warnings that Core Data is a more complex solution, and started reading. Three hours later, it worked for me. I had an array of tables stored in Core Data and reloading data when opening the application! The textbook code was quite simple to adapt, and I was able to save both the headers and the detailed arrays in it, only experimenting a little.
Therefore, for those who read this post, who are faced with problems like NSUserDefault or need something more than storing strings, consider spending an hour or two playing with the master data.
Here is a tutorial that I read:
http://www.raywenderlich.com/85578/first-core-data-app-using-swift
If you did not check "Master Data"
If you did not check “Baseline” when creating the application, you can add it later, and it only takes five minutes:
http://craig24.com/2014/12/how-to-add-core-data-to-an-existing-swift-project-in-xcode/
http://blog.zeityer.com/post/119012600864/adding-core-data-to-an-existing-swift-project
How to remove from master data lists
Delete data from Coredata Swift