mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-09 07:41:40 +00:00
Reduce startup time. (#1288)
Make global static a function local static. This stops it from being initialized premain and affecting startup time.
This commit is contained in:
parent
351e402426
commit
7cddc2b1be
@ -204,7 +204,14 @@ static ASTextKitRenderer *rendererForAttributes(ASTextKitAttributes attributes,
|
||||
}
|
||||
@dynamic placeholderEnabled;
|
||||
|
||||
static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
|
||||
static NSArray *DefaultLinkAttributeNames() {
|
||||
static NSArray *names;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
names = @[ NSLinkAttributeName ];
|
||||
});
|
||||
return names;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
@ -225,7 +232,7 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
|
||||
self.opaque = NO;
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
self.linkAttributeNames = DefaultLinkAttributeNames;
|
||||
self.linkAttributeNames = DefaultLinkAttributeNames();
|
||||
|
||||
// Accessibility
|
||||
self.isAccessibilityElement = YES;
|
||||
|
||||
@ -179,7 +179,14 @@ static NSString *ASTextNodeTruncationTokenAttributeName = @"ASTextNodeTruncation
|
||||
}
|
||||
@dynamic placeholderEnabled;
|
||||
|
||||
static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
|
||||
static NSArray *DefaultLinkAttributeNames() {
|
||||
static NSArray *names;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
names = @[ NSLinkAttributeName ];
|
||||
});
|
||||
return names;
|
||||
}
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
@ -200,9 +207,9 @@ static NSArray *DefaultLinkAttributeNames = @[ NSLinkAttributeName ];
|
||||
// The common case is for a text node to be non-opaque and blended over some background.
|
||||
self.opaque = NO;
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
|
||||
self.linkAttributeNames = DefaultLinkAttributeNames;
|
||||
|
||||
|
||||
self.linkAttributeNames = DefaultLinkAttributeNames();
|
||||
|
||||
// Accessibility
|
||||
self.isAccessibilityElement = YES;
|
||||
self.accessibilityTraits = self.defaultAccessibilityTraits;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user