1

I have recently started to look into iOS development (mainly in Swift), but one thing is not clear to me, and I can't find a good source for an answer.

Question: How is the model usually stored throughout the application lifetime in iOS? Let's say I have a list application (some kind of to-do app), with a couple of different views - list view, details view, finished todos view, todays todos and so on. If I create a model for this, a Todo class with some properties, where and how should this model (or a list of with instances of this class) be stored to be able to be retrieved from several different parts of the application?

Is it common to create a shared, singelton, "repository" class that holds the actual list of todo-items? Or should I create them and then pass them into the view that needs them when for example a user clicks on a button?

Is there a best practice for this when developing iOS applications, or which approach do you use?

Niklas
  • 384
  • 1
  • 7
  • These might help: http://stackoverflow.com/questions/7179236/how-to-deal-with-model-classes-in-ios-application http://stackoverflow.com/questions/21010864/ios-cocoa-design-pattern-for-data-model-controller – ftvs Aug 17 '15 at 06:46
  • alright, thanks! I didn't find these when I was searching around.. – Niklas Aug 17 '15 at 14:14

0 Answers0