Convert ASTextKitComponents to an object.

ARC doesn't play nicely with structs that contain references to
Objective-C objects, which causes breakage when using AsyncDisplayKit as
a dynamic framework (e.g., with CocoaPods 0.36+).  Fixes #198.
This commit is contained in:
Nadine Salter
2015-01-25 15:18:21 -08:00
parent 9cf71828ad
commit 35d7f43fb6
5 changed files with 22 additions and 16 deletions

View File

@@ -49,8 +49,8 @@
// TextKit.
ASDN::RecursiveMutex _textKitLock;
ASTextKitComponents _textKitComponents;
ASTextKitComponents _placeholderTextKitComponents;
ASTextKitComponents *_textKitComponents;
ASTextKitComponents *_placeholderTextKitComponents;
// Forwards NSLayoutManagerDelegate methods related to word kerning
ASTextNodeWordKerner *_wordKerner;
@@ -133,7 +133,7 @@
- (CGSize)calculateSizeThatFits:(CGSize)constrainedSize
{
ASTextKitComponents displayedComponents = [self isDisplayingPlaceholder] ? _placeholderTextKitComponents : _textKitComponents;
ASTextKitComponents *displayedComponents = [self isDisplayingPlaceholder] ? _placeholderTextKitComponents : _textKitComponents;
CGSize textSize = ASTextKitComponentsSizeForConstrainedWidth(displayedComponents, constrainedSize.width);
return CGSizeMake(constrainedSize.width, fminf(textSize.height, constrainedSize.height));
}