mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Fix the Initialization Hierarchy (#3207)
* Fix the initializers setup * Update Swift example * Remove incorrect comment * Add one to ASTableNode
This commit is contained in:
@@ -123,14 +123,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
ASDISPLAYNODE_NOT_DESIGNATED_INITIALIZER();
|
||||
UICollectionViewLayout *nilLayout = nil;
|
||||
self = [self initWithCollectionViewLayout:nilLayout]; // Will throw an exception for lacking a UICV Layout.
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (instancetype)initWithCollectionViewLayout:(UICollectionViewLayout *)layout
|
||||
{
|
||||
return [self initWithFrame:CGRectZero collectionViewLayout:layout layoutFacilitator:nil];
|
||||
@@ -143,17 +135,14 @@
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout layoutFacilitator:(id<ASCollectionViewLayoutFacilitatorProtocol>)layoutFacilitator
|
||||
{
|
||||
__weak __typeof__(self) weakSelf = self;
|
||||
ASDisplayNodeViewBlock collectionViewBlock = ^UIView *{
|
||||
// Variable will be unused if event logging is off.
|
||||
__unused __typeof__(self) strongSelf = weakSelf;
|
||||
return [[[strongSelf collectionViewClass] alloc] _initWithFrame:frame collectionViewLayout:layout layoutFacilitator:layoutFacilitator eventLog:ASDisplayNodeGetEventLog(strongSelf)];
|
||||
};
|
||||
|
||||
if (self = [super initWithViewBlock:collectionViewBlock didLoadBlock:nil]) {
|
||||
return self;
|
||||
if (self = [super init]) {
|
||||
__weak __typeof__(self) weakSelf = self;
|
||||
[self setViewBlock:^{
|
||||
__typeof__(self) strongSelf = weakSelf;
|
||||
return [[[strongSelf collectionViewClass] alloc] _initWithFrame:frame collectionViewLayout:layout layoutFacilitator:layoutFacilitator eventLog:ASDisplayNodeGetEventLog(strongSelf)];
|
||||
}];
|
||||
}
|
||||
return nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark ASDisplayNode
|
||||
|
||||
Reference in New Issue
Block a user