Monday October 31, 2011

Avoiding View Controller Spaghetti

Matthijs Hollemans has an excellent three part tutorial on making your classes talk to each other in the Cocoa Touch idioms.

I’ve been brought in to help a lot of teams new to iOS as they try to figure out how to get view controllers to play together. Unfortunately, I see too many use the app delegate as a central repository that every view controller queries for all kinds of application state. Bad idea. Better idea: plain old dependency injection. Matthijs shows you the Cocoa way to pull that off.

If you’ve ever found yourself trying to figure out how to get two different view controllers to share a data model, or have updates from one influence another, you need to read these tutorials.