Home > DeveloperSection > Interviews > Tell me about the MVC architecture in iOS?

Posted on    August-19-2015 11:46 PM

 iPhone iPhone  Ios  Objective C 
 1 Answer(s)
  673  View(s)
Rate this:

Tarun Kumar

Total Post:107

Posted on    August-19-2015 11:46 PM

The Model-View-Controller (MVC) design pattern assigns objects in an application one of three roles:

Model, View, or Controller.

The pattern defines not only the roles objects play in the application, it defines the way objects communicate with each other. Each of the three types of objects is separated from the others by abstract boundaries and communicates with objects of the other types across those boundaries. The collection of objects of a certain MVC type in an application is sometimes referred to as a layer—for example, model layer.

Model Objects: Model objects encapsulate the data specific to an application and define the logic and computation that manipulate and process that data. For example, a model object might represent a character in a game or a contact in an address book.

View Objects: A view object is an object in an application that users can see. A view object knows how to draw itself and can respond to user actions. A major purpose of view objects is to display data from the application’s model objects and to enable the editing of that data.

Controller object: A controller object acts as a coordinator or as an intermediary between one or more view objects and one or more model objects. In the Model-View-Controller design pattern, a controller object (or, simply, a controller) interprets user actions and intentions made in view objects—such as when the user taps or clicks a button or enters text in a text field—and communicates new or changed data to the model objects.

Don't want to miss updates? Please click the below button!

Follow MindStick