mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-21 05:39:01 +00:00
Copy sublayers to avoid NSFastEnumerationMutation exception
This commit is contained in:
parent
4ffaebc93b
commit
a90a83b607
@ -351,7 +351,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
/**
|
/**
|
||||||
* @abstract The receiver's immediate subnodes.
|
* @abstract The receiver's immediate subnodes.
|
||||||
*/
|
*/
|
||||||
@property (nonatomic, readonly, strong) NSArray<ASDisplayNode *> *subnodes;
|
@property (nonatomic, readonly, copy) NSArray<ASDisplayNode *> *subnodes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @abstract The receiver's supernode.
|
* @abstract The receiver's supernode.
|
||||||
|
|||||||
@ -51,7 +51,9 @@ extern void ASDisplayNodePerformBlockOnEveryNode(CALayer *layer, ASDisplayNode *
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (layer) {
|
if (layer) {
|
||||||
for (CALayer *sublayer in [layer sublayers]) {
|
/// NOTE: The docs say `sublayers` returns a copy, but it does not.
|
||||||
|
/// See: http://stackoverflow.com/questions/14854480/collection-calayerarray-0x1ed8faa0-was-mutated-while-being-enumerated
|
||||||
|
for (CALayer *sublayer in [[layer sublayers] copy]) {
|
||||||
ASDisplayNodePerformBlockOnEveryNode(sublayer, nil, block);
|
ASDisplayNodePerformBlockOnEveryNode(sublayer, nil, block);
|
||||||
}
|
}
|
||||||
} else if (node) {
|
} else if (node) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user