MVC, can simulate saving / loading its data?

Quick question, my data model is a singleton object and contains a list of names that I want to archive. My idea is to make the model responsible for loading and saving its own data. The model method loadwill be called by ViewController viewDidLoadand savewith ViewController applicationWillTerminate. I could do the loading / saving directly in the ViewController, but that would be dirty since the list of names is a model instance variable.

Gary

+3
source share
2 answers

init dealloc ( ). , . , loadData - , init.

+2

Apple , , , , , - accessor, . -names, -load ( , +load ).

+1

Source: https://habr.com/ru/post/1736683/


All Articles