4 ms·
Target-Action: A button needs to send a click action to a target handler. Dependency Injection: A controller requires a service (e.g. access to some API) to wo
by programmarchy 9y ago
Target-Action: A button needs to send a click action to a target handler.
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).
- LeoNatan25 9y ago> Target-Action: A button needs to send a click action to a target handler. That is selling the responder chain very very short.