mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 06:35:51 +00:00
Implement getter methods for new table / collection delegate / dataSource. Make ASTableView node-backed.
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user