Search code examples
iosarchitecturecode-reuse

Architecture of iOS project


In iOS generally we follow MVC project structure but it makes our view controller very massive.

I seen many Github projects but there is no such example which makes my view controller small, modular code, reusable code and many more things.

Generally what i am doing is something like this... Image of architecture

  • Service layer handles the logic whether they want to save the data in CoreData or not and also provides proper parameters for network layer to make api call..
  • Network Layer calls the api with or without header or token according to requirement and then get the response and then parse the data and provide the temp model to service layer.

But still i am unable to find the best way to create architecture for iOS project. It would be really helpful if someone will provide me any link or provide us any github link of their code.


Solution

  • I've written a quick introduction to MVVM. It explains briefly what MVVM is and why you should use it over MVC. Here's a more detailed look at MVVM.

    If you need more granulation, you can use VIPER.

    In my opinion MVVM is great for small/medium projects and VIPER should be considered in huge projects with a lot of contributors.

    You need some language mechanic for binding in MVVM. KVO does the job, but it's API isn't very good. You could try ReactiveCocoa for data binding in MVVM/VIPER.