mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
[ASLayoutSpec.mm] Remove use of dictionary to hold children
Converted the backing store of children to a std::vector. Subclass now have defined indexes instead of string keys to add children.
This commit is contained in:
@@ -14,7 +14,8 @@
|
||||
#import "ASBaseDefines.h"
|
||||
#import "ASLayout.h"
|
||||
|
||||
static NSString * const kBackgroundChildKey = @"kBackgroundChildKey";
|
||||
static NSUInteger const kForegroundChildIndex = 0;
|
||||
static NSUInteger const kBackgroundChildIndex = 1;
|
||||
|
||||
@interface ASBackgroundLayoutSpec ()
|
||||
@end
|
||||
@@ -28,7 +29,7 @@ static NSString * const kBackgroundChildKey = @"kBackgroundChildKey";
|
||||
}
|
||||
|
||||
ASDisplayNodeAssertNotNil(child, @"Child cannot be nil");
|
||||
[self setChild:child];
|
||||
[self setChild:child forIndex:kForegroundChildIndex];
|
||||
self.background = background;
|
||||
return self;
|
||||
}
|
||||
@@ -63,12 +64,12 @@ static NSString * const kBackgroundChildKey = @"kBackgroundChildKey";
|
||||
|
||||
- (void)setBackground:(id<ASLayoutable>)background
|
||||
{
|
||||
[super setChild:background forIdentifier:kBackgroundChildKey];
|
||||
[super setChild:background forIndex:kBackgroundChildIndex];
|
||||
}
|
||||
|
||||
- (id<ASLayoutable>)background
|
||||
{
|
||||
return [super childForIdentifier:kBackgroundChildKey];
|
||||
return [super childForIndex:kBackgroundChildIndex];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user