Skip to content

Latest commit

 

History

History
29 lines (24 loc) · 1.07 KB

File metadata and controls

29 lines (24 loc) · 1.07 KB

App Logo

MVC (Design Pattern)

MVC is a design pattern — a rule that helps you organize your code cleanly into 3 parts: M → Model, V → View, C → Controller

It helps you separate: 1- your data (Model) 2- your UI (View) 3- your logic that connects the two (Controller)

1. MODEL — “The Brain / Data Layer”

What it does: The Model holds your data and business logic. It doesn’t know anything about the UI. Think of it like: A JSON response, a struct, or a class that stores info — e.g. a “User”, “Contact”, or “Task”.

2. VIEW — “The Face / UI Layer”

What it does: The View displays data to the user and handles how it looks. It knows how to show something, but doesn’t know what to show until the Controller tells it. Think of it like: Buttons, labels, images, table cells, storyboards, xib files, etc.

3. CONTROLLER — “The Middleman / Coordinator Layer”

What it does: The Controller connects the Model (data) and the View (UI). It tells the View what to show, and updates the Model when the user interacts with the UI.