I was wondering why can’t I write let itemStore = ItemStore()
in ItemsViewController (viewDidLoad), instead of AppDelegate?
Thanks
I was wondering why can’t I write let itemStore = ItemStore()
in ItemsViewController (viewDidLoad), instead of AppDelegate?
Thanks
It’s mainly for code testability. You use Dependency Injection to achieve that.
http://artsy.github.io/blog/2016/06/27/dependency-injection-in-swift/