The 2nd Dnepropetrovsk iOS Practice Leaders Community Meet-Up.
MVC by Dmitriy Sai, iOS developer with 3+ years of experience.
The following presentation covers the issues of the practical use of Model View Controller on iOS, focusing on the principles of roles’ division, clear code, simplification of refactoring and unit-testing.
3. Agenda
● History
● MVC
● Controller specifications
● View specifications
● Model specifications
● Demo
4. History
Model View Controller (MVC) is one of the most quoted
(and most misquoted) patterns around. It started as a
framework developed by Trygve Reenskaug for the
Smalltalk platform in the late 1970s. Since then it has
played an influential role in most UI frameworks and in
the thinking about UI design.
5. MVC
● Controller sends commands to the model to update state.
Also sends commands to its associated view to change
the appearance.
6. MVC
● Controller sends commands to the model to update state.
Also sends commands to its associated view to change
the appearance.
● A model notifies its controllers when there has been a
change in its state. This notification allows the views to
produce updated output.
7. MVC
● Controller sends commands to the model to update state.
Also sends commands to its associated view to change
the appearance.
● A model notifies its controllers when there has been a
change in its state. This notification allows the views to
produce updated output.
● A view requests information from the model that it needs
for generating an output representation to the user.
10. MVC
Model specifications:
● business logic
● has knowledge about itself but does not know
about the controllers and views;
● in some cases is a database manager or a set
of objects;
11. MVC
Business logic - real-world business rules that determine
how data can be created, displayed, stored, and changed.
26. MVC
Controller specifications:
● can transmit data
● can place Views on the screen
● can respond to user’s actions
● can operate with several Views