Access iOS data throughout the application

I am learning the most efficient and secure way to process data in an iOS application.

I used singleton, but after reading a number of articles, I came to the conclusion that this is not the best way to process data, singleton data is essentially global variables.

My application data is stored in plist with a controller (DataManager) that handles the conversion from the plist file to the variables stored in the DataManager class.

What other options are there for accessing this data for my view controller, subsequent scenes (I use SKSpriteKit), and the application delegate? It has been found to make the DataManager single or create multiple instances of the DataManager throughout the program.

I was thinking about transferring data between scenes when clicking and dragging, but would this cause a high level of traction?

Relations Byron

+3
source share
1 answer
  • Sending data back and forth between ViewControllers is a concept that can be said to be definitely wrong. - this is not MVC

  • Since the data you need to access does not seem huge (for example, huge arrays, a lot of text, or any data that would be nice to store in a database), the Singleton template may seem like a good idea.

  • NSUserDefaults - initially it’s useful to save only settings or some static data, such as username, tokens, and if it is important to save data even after the application is killed.

  • , , .

,

[ProgressManager sharedInstance].level = level;

MVC, . VC , , .

, , ( ), , .

, , .

+1

All Articles