Understanding the structure of an iOS app
Every iOS app follows a standard structure known as a Model-View-Controller
(MVC) pattern. For now, it’s enough to know that a pattern is a standard
way of writing software for a particular goal.
Specifically, the Model-View-Controller pattern splits the code of an app into
? The data it manages (known as the Model)
? The user-interface elements (known as the View)
? The Controller, which is the component that sits in between the Model
and the View (or views) and translates user actions into updates to the
Model and the View.
The dashed lines indicate linkage.
Therefore, the model is linked to the view, and the views are linked to the
controller. The solid lines indicate actions. So, the view updates portions of
the model while the controller updates the views (or more correctly, causes
the views to update themselves). The controller also updates models as
needed. iOS extends this pattern so that each app is really a hierarchy of
controllers, each managing a set of views and potentially a model
No comments:
Post a Comment