A MVVM framework based on ReactiveCocoa and built with a goal to sepparate untestable UIKit view logic from testable business logic.
Well it's pretty simple:
- We create a new Model class:
@interface MYViewModel : IOTableViewModel
- We subclass any of the IO view controllers:
@interface MYViewController : IOTableViewController
- Then we implement the binding methods:
- (void)pre
{
[super pre];
//This is where all the things prior to initializing the view go.
//For example:
[self rac_signalForSelector:@selector(scrollViewDidScroll:)
fromProtocol:@protocol(UIScrollViewDelegate)];
}
- (void)setupViews
{
[super setupViews];
//Here we set up our view like we do on viewDidLoad. For example:
[self.view addSubview:self.doneButton];
}
- (void)post
{
[super post];
//After we setup the views, we want to bind our view model against
//them, this is where all that magic goes. For example:
RAC(self.doneButton, userInteractionEnabled) =
RACObserve(self.viewModel, doneEnabled);
}
- Now just instantiate your view controller with the model and you're done:
MYViewModel *vm = [[MYViewModel alloc] init];
MYViewController *vc = [[MYViewController alloc] initWithViewModel:vm];
rprtr should be a good resource, this project was developed against it.
You can build it as a regular framework, but I recommend using CocoaPods:
pod 'iodine'
- UIViewController (IOViewController)
- UITableViewController (IOTableViewController)
- UITableHeaderFooterView (IOTableHeaderFooterView)
- UITableViewCell (IOTableViewCell)