IDTableModuleCore
Easy module configuration based on UITableView.
Getting started
no time to explain, just look example
Contractor
@class MyViewModel;
@interface MyContractor : IDMVVMTableContractor <IDMVVMTableContractorProtocol>
@property (nonatomic, weak) MyViewModel *viewModel;
@end
/* */
@implementation MyContractor
#pragma mark - Override
- (UITableViewRowAnimation)insertAnimation {
return UITableViewRowAnimationFade;
}
- (UITableViewRowAnimation)deleteAnimation {
return UITableViewRowAnimationFade;
}
- (void)bindCellViewModels {
[self rac_liftSelector:@selector(scrollToRowWithIndexPath:) withSignals:RACObserve(self.viewModel, nonValidIndexPath), nil];
[self rac_liftSelector:@selector(handleIncomingSectionViewModels:) withSignals:RACObserve(self.viewModel, sectionViewModels), nil];
}
#pragma mark - TableViewDelegate methods
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger row = (NSUInteger)indexPath.row;
NSUInteger section = (NSUInteger)indexPath.section;
id<IDCellViewModelProtocol> cellViewModel = self.viewModel.sectionViewModels[section].cellViewModels[row];
IDTableViewCell *cell = [super tableView:tableView
cellForRowAtIndexPath:indexPath
withIdentifier:cellViewModel.uniqueCellIdentifier
viewModel:cellViewModel];
return cell;
}
#pragma mark - TableViewDataSource methods
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return self.viewModel.sectionViewModels.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.viewModel.sectionViewModels[section].cellViewModels.count;
}
@end
Example
To run the example project, clone the repo, and run pod install --project-directory=Example
first.
Installation with CocoaPods
CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like IDTableModuleCore in your projects. You can install it with the following command:
$ gem install cocoapods
Podfile
To integrate IDTableModuleCore into your Xcode project using CocoaPods, specify it in your Podfile
:
platform :ios, '9.3'
use_frameworks!
target 'TargetName' do
pod 'IDTableModuleCore'
end
Then, run the following command:
$ pod install
Requirements
Minimum iOS Target is ios 9.0.
License
IDTableModuleCore is released under the MIT license. See LICENSE for details.
Author
Andrey Bronnikov, [email protected]