Model-View-Controller
Model-View-Controller, or MVC, is a design pattern that is based on the idea that any class that you create should fall into one of three job categories: model, view, or controller. Here is a breakdown of the division of labor:
-
Models are responsible for storing data and making it available to other objects. Models have no knowledge of the user interface or how to draw themselves on the screen. Their sole purpose is holding and managing data. For example, an application that tracks attendance for a school would define a model object for Student. A Student would “model” all of the attributes a real student would have, such as a name and a grade. Swift types like String and Array are traditional building blocks ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access