Latest | 0.1.1 |
---|---|
Homepage | https://github.com/delanoir/iodine |
License | MIT |
Platforms | ios 7.1, requires ARC |
Dependencies | ReactiveCocoa, ReactiveViewModel |
Authors |
A MVVM framework based on ReactiveCocoa and built with a goal to sepparate untestable UIKit view logic from testable business logic.
How does it work?
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];
Okay, now can I get a real example?
rprtr should be a good resource, this project was developed against it.
What about installing the framework?
You can build it as a regular framework, but I recommend using CocoaPods:
pod 'iodine'
Currently supported UIKit classes
- UIViewController (IOViewController)
- UITableViewController (IOTableViewController)
- UITableHeaderFooterView (IOTableHeaderFooterView)
- UITableViewCell (IOTableViewCell)
Latest podspec
{ "name": "iodine", "version": "0.1.1", "summary": "iodine is a Reactive MVVM framework base on ReactiveCocoa", "homepage": "https://github.com/delanoir/iodine", "license": "MIT", "authors": { "Karolis Stasaitis": "[email protected]" }, "source": { "git": "https://github.com/delanoir/iodine.git", "tag": "0.1.1" }, "platforms": { "ios": "7.1" }, "requires_arc": true, "source_files": "iodine/", "dependencies": { "ReactiveCocoa": [], "ReactiveViewModel": [] } }
Mon, 29 Feb 2016 23:01:03 +0000