I'm a bit confused with MVC pattern in Swift/Obj C .
Should I put UITableViewCell into View folder and ViewController to Controller folder?
UITableViewCell file : View
UIViewController file : Controller
Class file which contains your object data : Model
First of all. Let's take a quick look on MVC :
Model View Controller or MVC as it is popularly called is made up of the following three parts :
Model − Responsible for maintaining data.
View − Responsible for displaying the data to the user.
Controller − Software Code that controls the interactions between the Model and View.
For a while i was confused about what is the best place for UITableViewCell file ! I have asked my senior, explored blogs and the most important thing was giving my self a minute to think logically and finally i have got the answer.
So my answer is a some kind of sharing knowledge with you and the others from the future.
When you are working with a table view, you have a UITableViewCell files, UIViewController file and a class file which contains your data. Right ?
First things first, u can easily figure out that UIViewController should be in Controller folder and the class file which contains your object data should be in Model folder.
This file contains the outlets of your cell which are responsible for displaying the data to user. Simple.
Good luck :)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.