Implement getter methods for new table / collection delegate / dataSource. Make ASTableView node-backed.

This commit is contained in:
Scott Goodson
2015-12-24 18:02:52 -08:00
parent 27c151095b
commit c1640c7f59
3 changed files with 53 additions and 12 deletions

View File

@@ -20,11 +20,15 @@
@property (nonatomic) _ASTablePendingState *pendingState;
@end
@interface ASTableView ()
- (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style;
@end
@implementation ASTableNode
- (instancetype)initWithStyle:(UITableViewStyle)style
{
if (self = [super initWithViewBlock:^UIView *{ return [[ASTableView alloc] initWithFrame:CGRectZero style:style]; }]) {
if (self = [super initWithViewBlock:^UIView *{ return [[ASTableView alloc] _initWithFrame:CGRectZero style:style]; }]) {
return self;
}
return nil;
@@ -63,6 +67,15 @@
}
}
- (id <ASTableDelegate>)delegate
{
if ([self pendingState]) {
return _pendingState.delegate;
} else {
return self.view.asyncDelegate;
}
}
- (void)setDataSource:(id <ASTableDataSource>)dataSource
{
if ([self pendingState]) {
@@ -73,6 +86,15 @@
}
}
- (id <ASTableDataSource>)dataSource
{
if ([self pendingState]) {
return _pendingState.dataSource;
} else {
return self.view.asyncDataSource;
}
}
- (ASTableView *)view
{
return (ASTableView *)[super view];