TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Oct 2017 |
SwiftSwift Version | 4.0 |
SPMSupports SPM | ✗ |
Maintained by Arnaud Dorgans.
To run the example project, clone the repo, and run pod install
from the Example directory first.
IOViewModel is available through CocoaPods. To install
it, simply add the following line to your Podfile:
pod 'IOViewModel'
Install XCTemplate and generate instantly beautiful viewmodels
import IOViewModel
import RxSwift
import RxSwiftExt
class UserViewModel: IOViewModel {
typealias In = Input
typealias Out = Output
private (set) lazy var `in`: In = In(vm: self)
private (set) lazy var out: Out = Out(vm: self)
class Input: IOViewModelIn<UserViewModel> {
lazy var user = BehaviorSubject<User?>(value: nil)
}
class Output: IOViewModelOut<UserViewModel> {
var user: Observable<User> {
return self.in.user.unwrap()
}
var name: Observable<String> {
return user.map { $0.firstName + " " + $0.lastName }
}
}
}
let vm = UserViewModel()
userView.rx.user
.bind(to: vm.in.user)
.disposed(by: disposeBag)
vm.out.name
.bind(to: nameLabel.rx.text)
.disposed(by: disposeBag)
IOViewModel is published with xctemplate.
To install it, just go in xctemplates directory and run this command in a terminal:
sh install.sh
Arnoymous, [email protected]
IOViewModel is available under the MIT license. See the LICENSE file for more info.