I want to understand one thing in plain english that how do I actually use an standard MVC design pattern in iOS App.

I know about Modal View and Controller and theoretically I know what they do(Controller takes data from Modal and show it to View)

However lets say there is an app, which is simply using an api to login and on successful login it will show some data on table view on another viewcontroller.

So there will be two view controller, say LoginVC & showDetailsVC.

So theoretically below is what i will do:

In LoginVC, there is a Login method which will have a loginMethod in another class named GlobalMethodClass.

Likewise in showDetailsVC while fetching data from Api, I will get a dictionary of array , which I need to iterate in order to show data on tableview.

Sounds Simple right..😁

But, what should be the standard MVC format now, apart from LoginVC and showDetailsVC, how many classes should be made to perform this simple task?

Should I make another class for Global Variable for Username & passwords?

Kindly explain Which one is M, V and C in this, I am totally confused as in xcode we use Storyboard, which should be view, moreover Controller should be the LoginVC?, am I right?

Thanks in advance

  • 1
    Software patterns are about solving problems, not about following the pattern just for the sake of following it. What actual problem are you trying to solve with the MVC pattern here? – Robert Harvey Feb 28 '17 at 19:52
  • @RobertHarvey +1 Sir can you please advise me a book that I should read in order to understand design patterns and their uses in my iOS Development. – Ritesh.mlk Mar 1 '17 at 4:20
  • 'Controller takes data from Modal and show it to View'. I'm not sure this is how MVC is supposed to work, although it does on the web with the request/response model. Outside of that version of MVC, the view sends commands to the controller, which updates the model. Separately the view observes the model (observer pattern), and updates itself when the model changes. – bdsl Jul 29 '18 at 11:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.