DDMvvm is a library for who wants to start writing iOS application using MVVM (Model-View-ViewModel), written in Swift.
- Base classes for UIViewController, UIView, UITableViewCell and UICollectionCell
- Base classes for ViewModel, ListViewModel and CellViewModel
- Dependency injection using
Resolver
- Custom transitioning for UINavigationController and UIViewController
- iOS 11.0+
- Xcode 12.5+
- Swift 5.0+
The library heavily depends on RxSwift for data-binding and events. For who does not familiar with Reactive Programming, I suggest to start reading about it first. Beside that, here are the list of dependencies:
CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate Alamofire into your Xcode project using CocoaPods, specify it in your Podfile
:
pod 'DDMvvm', '~> 3.0'
The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift
compiler. It is in early development, but Alamofire does support its use on supported platforms.
Once you have your Swift package set up, adding Alamofire as a dependency is as easy as adding it to the dependencies
value of your Package.swift
.
dependencies: [
.package(url: "https://github.com/duyduong/DDMvvm.git", .upToNextMajor(from: "3.0.0"))
]
To run the example project, clone the repo, and run DDMvvm.xcworkspace
The library is mainly written using Generic, so please familiar yourself with Swift Generic, and very important point, we can’t use Generic UIViewController to associate with UIViewController on InterfaceBuilder or Storyboard. So programmatically is prefer, but we can still use XIBs to instantiate our view
Please check examples for details usages of these base classes.
Using Resolver for dependency injections
The library also supports for page transitions, including pages inside a navigation page and pages that presents modally. See examples for how to implement page transitions
DDMvvm is available under the MIT license. See the LICENSE file for more info.