Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xiangwangfeng/m80tableviewcomponent
A component-based library for UITableView
https://github.com/xiangwangfeng/m80tableviewcomponent
Last synced: about 1 month ago
JSON representation
A component-based library for UITableView
- Host: GitHub
- URL: https://github.com/xiangwangfeng/m80tableviewcomponent
- Owner: xiangwangfeng
- License: mit
- Created: 2019-07-20T08:37:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-05T10:49:40.000Z (8 months ago)
- Last Synced: 2024-12-11T22:51:37.668Z (about 1 month ago)
- Language: Objective-C
- Homepage:
- Size: 5.46 MB
- Stars: 120
- Watchers: 2
- Forks: 12
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# M80TableViewComponent
A component-based library for UITableView [δΈζηζ¬](./Documents/README.md)
| | Main Features |
----------|-----------------
π | No more indexpath and array out of range
π | Segregation of duties
π | UITableViewCell will be automatically reusable
π‘ | Data-driven
β | Safe model to view mapping
β‘οΈ | One way binding
π₯ | Easy to compose different components together
π | Simple support for height cache and precalculate
π | ListDiff supported# System Requirements
* iOS 9.0 or higher
* Xcode 11.0 or higher# Installation
### Cocoapods
```ruby
pod 'M80TableViewComponent'
```# QuickStart
### Define custom component
```objc
@implementation M80ItemComponent- (Class)cellClass
{
return UITableViewCell.class;
}- (CGFloat)height
{
return 44.0;
}- (void)configure:(UITableViewCell *)cell
{
cell.textLabel.text = self.title;
}@end
```
### Compose them
```objc
- (void)viewDidLoad
{
[super viewDidLoad];NSArray *components = @[[M80ItemComponent component:@"Text" vcName:@"M80TextViewController"],
[M80ItemComponent component:@"ListDiff" vcName:@"M80ListDiffViewController"],
[M80ItemComponent component:@"Feed" vcName:@"M80FeedViewController"]];
M80TableViewSectionComponent *section = [M80TableViewSectionComponent new];
section.components = components;
M80TableViewComponent *tableViewComponent = [[M80TableViewComponent alloc] initWithTableView:self.tableView];
tableViewComponent.sections = @[section];
tableViewComponent.context = context;
self.tableViewComponent = tableViewComponent;
}```
# Key Classes
| Class | Usage |
----------|-----------------
M80TableViewComponent | TableView component which holds many section components
M80TableViewSectionComponent | Section component which holds many cell components
M80TableViewCellComponent | Cell component which is used for managing UITableViewCell
M80TableViewViewComponent | View componnet
M80TableViewComponentContext | Class which holds the context information for the tableview component