4 ms·
As a full stack dev who has never written iOS apps, I have tried to understand the conceptual basics and how they compare. > Cocoa Touch is (I suspect) deliber
by liamzebedee 9y ago
As a full stack dev who has never written iOS apps, I have tried to understand the conceptual basics and how they compare.
> Cocoa Touch is (I suspect) deliberately very simple: there’s Target-Action pattern, Dependency Injection, Delegate and MVC
Can anyone enrich this explanation?
- WoodenChair 9y agoThese are pretty standard design patterns across most GUI frameworks. For instance Java Swing apps and Android apps also are commonly built with an MVC architecture. All four of these design patterns are not iOS specific, but they are design patterns the Cocoa Touch framework was made to be programmed against.
- programmarchy 9y agoTarget-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.