> Cocoa Touch is (I suspect) deliberately very simple: there’s Target-Action pattern, Dependency Injection, Delegate and MVC
Can anyone enrich this explanation?
> Cocoa Touch is (I suspect) deliberately very simple: there’s Target-Action pattern, Dependency Injection, Delegate and MVC
Can anyone enrich this explanation?
Dependency Injection: A controller requires a service (e.g. access to some API) to work, so it's injected into the instance typically by the constructor. Think hierarchy or dependency graph.
Delegate: A table view draws cells in a table but it doesn't know how to draw them, so it delegates this to something else, typically the containing view controller. Data Sources are a similar concept but instead of asking the receiver to do something it asks the receiver a question about the data it's supposed to model. For example the table view would ask how many sections and rows do I have.
MVC: Model (data), View (visual representation of data), Controller (controlling flow of data to and from its visual representation).
That is selling the responder chain very very short.