MVVMKit is a protocol oriented library that defines a possible way to adopt the MVVM in your iOS application.
Optionally MVVMKit give you the possibility to take out the navigation responsibility from the view model and put it inside a
In general using MVVMKit most of your software types should belong to one of the following categories:
The actual data manipulated by your applications.
Model type can be
NSManagedObject fetched from a Core Data database or
Codable instances coming from a web server.
- Maintain the state of the application
The user interface. On iOS views are typically subclasses of
- Show the application content.
- Deliver the user interaction to a
A subclass of
- Deliver the user interaction to the View Model
- Bind the View Model to the view
Note: on iOS we divide the View entity of the MVVM pattern in two entities:
The actual "brain" of a scene of your application.
- Manage the model
- Present the model in a way that is immediately suitable for the view
- Notify the view controller when it should update the view (a.k.a. make a bind)
The entity responsible for the application navigation.
- Decide which is (and how to show) the next view controller
- Instantiate view controllers and associated view models doing appropriate dependency injections
To run the example project, clone the repo, and run
pod install from the Example directory first.
MVVMKit is available through CocoaPods. To install it, simply add the following line to your Podfile:
MVVMKit is also available as a Swift Package.
MVVMKit is available under the MIT license. See the LICENSE file for more info.
Templates/MVVMKit folder into
The result should be the following: