Showing posts with label MVVM. Show all posts
Showing posts with label MVVM. Show all posts

Saturday, 23 May 2020


ECommerce sample project using API data read and CoreData local storage with Codable protocol that is use for beginners
  • Asynchronously data fetch from API
  • CoreData use for local storage
  • Relationship manage in CoreData
  • Unique constraints manage in CoreData
  • Codable protocol use for read and store data with CoreData
  • Filter data with dynamic key using NSSortDescriptor
  • Sorting data

Tuesday, 28 August 2018

Swift MVVM design pattern


Design pattern is an important part for code reusability.

History
Since the beginning of it's development, iOS has used MVC (Model View Controller) design pattern, which helps the developers to reuse code. It also helps to keep UI and business logic separately.

Why MVVM ?
In MVC, As the View and Controller is combined in the ViewController, the controller overloaded. So in order to reduce the code size in controller, MVVM pattern has been introduced.

In MVVM pattern, ViewController does not interact directly with the Model unlike in MVC. Here, ViewController interacts with ViewModel, and ViewModel interact with the Model.

Model(Database) <-->ViewModel (Business Logic) <--> ViewController (UI/View related code)

There are some other architecture design pattern also there like MVC, MVP, MVVM, Viper etc.

Check out below link for MVVM architecture pattern example in Swift.

https://youtu.be/FBJzPppZLsg