Please recommend a patterns book for iOS development
- by Brett Ryan
I've read several books on iOS development and Objective-C, however what a lot of them teach is how to work with interfaces and all contain the model inside the view controller, i.e. a UITableViewController based view will simply have an NSArray as it's model. I'm interested in what the best practices are for designing the structure of an application.
Specifically I'm interested in best practices for the following:
How to separate a model from the view controller. I think I know how to do this by simply replacing the NSArray style example with a specific model object, however what I do not know how to do is alert the view when the model changes. For example in .NET I would solve this by conforming to INotifyPropertyChanged and databinding, and similarly with Java I would use PropertyChangeListener.
How to create a service model for my domain objects. For example I want to learn the best way to create a service for a hypothetical Widget object to manage an internal DB and also services for communicating with remote endpoints. I need to learn the best ways to do this in a way that interface components can subscribe to events such as widgetUpdated. These services should be singleton classes and some how dependency injected into model/controller objects.
Books I've read so far are:
Programming in Objective-C (4th Edition)
Beginning iOS 5 Development: Exploring the iOS SDK
The iOS 5 Developer's Cookbook: Expanded Electronic Edition: Essentials and Advanced Recipes for iOS Programmers
Learn Objective-C on the Mac: For OS X and iOS
I've also purchased the following updated books but not yet read them.
The Core iOS 6 Developer's Cookbook (4th edition
Programming in Objective-C (5th Edition)
I come from a Java and C# background with 15 years experience, I understand that many of the ways I would do things in these languages may not fit to the ObjC way of developing applications.
Any guidance on the topic is very much appreciated.