From 5e3627a9cdb85d5608007327df7017bb76ca29a2 Mon Sep 17 00:00:00 2001 From: Adlai Holler Date: Thu, 1 Sep 2016 16:43:03 -0700 Subject: [PATCH] [ASTextNode] Actually deprecate attributedString property (#2151) --- AsyncDisplayKit/ASButtonNode.mm | 8 ++++---- AsyncDisplayKit/ASCellNode.mm | 20 +++++++++---------- AsyncDisplayKit/ASImageNode.mm | 4 ++-- AsyncDisplayKit/ASTextNode.h | 6 +++--- AsyncDisplayKit/ASVideoPlayerNode.mm | 10 +++++----- AsyncDisplayKit/AsyncDisplayKit+Debug.m | 2 +- .../Sample/SupplementaryNode.m | 2 +- examples/ASDKgram/Sample/PhotoCellNode.m | 6 +++--- .../Sample/OverviewComponentsViewController.m | 8 ++++---- .../CatDealsCollectionView/Sample/BlurbNode.m | 2 +- .../CatDealsCollectionView/Sample/ItemNode.m | 16 +++++++-------- examples/Kittens/Sample/BlurbNode.m | 2 +- examples/Kittens/Sample/KittenNode.mm | 2 +- .../SocialAppLayout/Sample/CommentsNode.m | 2 +- examples/SocialAppLayout/Sample/LikesNode.m | 2 +- examples/SocialAppLayout/Sample/PostNode.m | 8 ++++---- .../Swift/Sample/TailLoadingCellNode.swift | 2 +- .../Sample/RandomCoreGraphicsNode.m | 2 +- .../ASTraitCollection/Sample/KittenNode.m | 2 +- .../Sample/OverrideViewController.m | 2 +- .../CarthageExample/ViewController.m | 2 +- .../Sample/SupplementaryNode.m | 2 +- .../EditableText/Sample/ViewController.m | 2 +- examples_extra/Multiplex/Sample/ScreenNode.m | 2 +- examples_extra/Placeholders/Sample/PostNode.m | 2 +- .../Sample/RandomCoreGraphicsNode.m | 2 +- .../SynchronousKittens/Sample/BlurbNode.m | 2 +- .../SynchronousKittens/Sample/KittenNode.mm | 2 +- .../VideoTableView/Sample/BlurbNode.m | 2 +- .../VideoTableView/Sample/NicCageNode.mm | 2 +- .../Life Without CocoaPods/ViewController.m | 2 +- 31 files changed, 65 insertions(+), 65 deletions(-) diff --git a/AsyncDisplayKit/ASButtonNode.mm b/AsyncDisplayKit/ASButtonNode.mm index 6341f13732..d00edf25ad 100644 --- a/AsyncDisplayKit/ASButtonNode.mm +++ b/AsyncDisplayKit/ASButtonNode.mm @@ -183,8 +183,8 @@ newTitle = _normalAttributedTitle; } - if ((_titleNode != nil || newTitle.length > 0) && [self.titleNode.attributedString isEqualToAttributedString:newTitle] == NO) { - _titleNode.attributedString = newTitle; + if ((_titleNode != nil || newTitle.length > 0) && [self.titleNode.attributedText isEqualToAttributedString:newTitle] == NO) { + _titleNode.attributedText = newTitle; self.accessibilityLabel = _titleNode.accessibilityLabel; [self setNeedsLayout]; } @@ -479,7 +479,7 @@ [children addObject:_imageNode]; } - if (_titleNode.attributedString.length > 0) { + if (_titleNode.attributedText.length > 0) { [children addObject:_titleNode]; } @@ -508,7 +508,7 @@ [super layout]; _backgroundImageNode.hidden = (_backgroundImageNode.image == nil); _imageNode.hidden = (_imageNode.image == nil); - _titleNode.hidden = (_titleNode.attributedString.length == 0); + _titleNode.hidden = (_titleNode.attributedText.length == 0); } @end diff --git a/AsyncDisplayKit/ASCellNode.mm b/AsyncDisplayKit/ASCellNode.mm index a096a233dd..6a153d5831 100644 --- a/AsyncDisplayKit/ASCellNode.mm +++ b/AsyncDisplayKit/ASCellNode.mm @@ -297,7 +297,7 @@ static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f; - (instancetype)init { - return [self initWithAttributes:[self defaultTextAttributes] insets:[self defaultTextInsets]]; + return [self initWithAttributes:[ASTextCellNode defaultTextAttributes] insets:[ASTextCellNode defaultTextInsets]]; } - (instancetype)initWithAttributes:(NSDictionary *)textAttributes insets:(UIEdgeInsets)textInsets @@ -306,8 +306,8 @@ static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f; if (self) { _textInsets = textInsets; _textAttributes = [textAttributes copy]; + self.automaticallyManagesSubnodes = YES; _textNode = [[ASTextNode alloc] init]; - [self addSubnode:_textNode]; } return self; } @@ -317,12 +317,12 @@ static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f; return [ASInsetLayoutSpec insetLayoutSpecWithInsets:self.textInsets child:self.textNode]; } -- (NSDictionary *)defaultTextAttributes ++ (NSDictionary *)defaultTextAttributes { return @{NSFontAttributeName : [UIFont systemFontOfSize:kASTextCellNodeDefaultFontSize]}; } -- (UIEdgeInsets)defaultTextInsets ++ (UIEdgeInsets)defaultTextInsets { return UIEdgeInsetsMake(kASTextCellNodeDefaultVerticalPadding, kASTextCellNodeDefaultHorizontalPadding, kASTextCellNodeDefaultVerticalPadding, kASTextCellNodeDefaultHorizontalPadding); } @@ -333,14 +333,14 @@ static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f; _textAttributes = [textAttributes copy]; - [self updateAttributedString]; + [self updateAttributedText]; } - (void)setTextInsets:(UIEdgeInsets)textInsets { _textInsets = textInsets; - [self updateAttributedString]; + [self setNeedsLayout]; } - (void)setText:(NSString *)text @@ -349,17 +349,17 @@ static const CGFloat kASTextCellNodeDefaultVerticalPadding = 11.0f; _text = [text copy]; - [self updateAttributedString]; + [self updateAttributedText]; } -- (void)updateAttributedString +- (void)updateAttributedText { if (_text == nil) { - _textNode.attributedString = nil; + _textNode.attributedText = nil; return; } - _textNode.attributedString = [[NSAttributedString alloc] initWithString:self.text attributes:self.textAttributes]; + _textNode.attributedText = [[NSAttributedString alloc] initWithString:self.text attributes:self.textAttributes]; [self setNeedsLayout]; } diff --git a/AsyncDisplayKit/ASImageNode.mm b/AsyncDisplayKit/ASImageNode.mm index e3262c77d3..cdd428b313 100644 --- a/AsyncDisplayKit/ASImageNode.mm +++ b/AsyncDisplayKit/ASImageNode.mm @@ -326,12 +326,12 @@ struct ASImageNodeDrawParameters { CGFloat pixelCountRatio = (imageSizeInPixels.width * imageSizeInPixels.height) / (boundsSizeInPixels.width * boundsSizeInPixels.height); if (pixelCountRatio != 1.0) { NSString *scaleString = [NSString stringWithFormat:@"%.2fx", pixelCountRatio]; - _debugLabelNode.attributedString = [[NSAttributedString alloc] initWithString:scaleString attributes:[self debugLabelAttributes]]; + _debugLabelNode.attributedText = [[NSAttributedString alloc] initWithString:scaleString attributes:[self debugLabelAttributes]]; _debugLabelNode.hidden = NO; [self setNeedsLayout]; } else { _debugLabelNode.hidden = YES; - _debugLabelNode.attributedString = nil; + _debugLabelNode.attributedText = nil; } } diff --git a/AsyncDisplayKit/ASTextNode.h b/AsyncDisplayKit/ASTextNode.h index e59e11bd4f..fcf7fcaae5 100644 --- a/AsyncDisplayKit/ASTextNode.h +++ b/AsyncDisplayKit/ASTextNode.h @@ -291,16 +291,16 @@ typedef NS_ENUM(NSUInteger, ASTextNodeHighlightStyle) { @see attributedText */ -@property (nullable, nonatomic, copy) NSAttributedString *attributedString; +@property (nullable, nonatomic, copy) NSAttributedString *attributedString ASDISPLAYNODE_DEPRECATED; /** - The truncationAttributedString and truncationAttributedText properties are equivalent, but attributedText is now the + The truncationAttributedString and truncationAttributedText properties are equivalent, but truncationAttributedText is now the standard API name in order to match UILabel and ASEditableTextNode. @see truncationAttributedText */ -@property (nullable, nonatomic, copy) NSAttributedString *truncationAttributedString; +@property (nullable, nonatomic, copy) NSAttributedString *truncationAttributedString ASDISPLAYNODE_DEPRECATED; @end diff --git a/AsyncDisplayKit/ASVideoPlayerNode.mm b/AsyncDisplayKit/ASVideoPlayerNode.mm index d0fc1bbb9a..f105aa4b2b 100644 --- a/AsyncDisplayKit/ASVideoPlayerNode.mm +++ b/AsyncDisplayKit/ASVideoPlayerNode.mm @@ -346,7 +346,7 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; { if (_elapsedTextNode == nil) { _elapsedTextNode = [[ASTextNode alloc] init]; - _elapsedTextNode.attributedString = [self timeLabelAttributedStringForString:@"00:00" + _elapsedTextNode.attributedText = [self timeLabelAttributedStringForString:@"00:00" forControlType:ASVideoPlayerNodeControlTypeElapsedText]; _elapsedTextNode.truncationMode = NSLineBreakByClipping; @@ -359,7 +359,7 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; { if (_durationTextNode == nil) { _durationTextNode = [[ASTextNode alloc] init]; - _durationTextNode.attributedString = [self timeLabelAttributedStringForString:@"00:00" + _durationTextNode.attributedText = [self timeLabelAttributedStringForString:@"00:00" forControlType:ASVideoPlayerNodeControlTypeDurationText]; _durationTextNode.truncationMode = NSLineBreakByClipping; @@ -428,7 +428,7 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; return; } NSString *formattedDuration = [self timeStringForCMTime:_duration forTimeLabelType:ASVideoPlayerNodeControlTypeDurationText]; - _durationTextNode.attributedString = [self timeLabelAttributedStringForString:formattedDuration forControlType:ASVideoPlayerNodeControlTypeDurationText]; + _durationTextNode.attributedText = [self timeLabelAttributedStringForString:formattedDuration forControlType:ASVideoPlayerNodeControlTypeDurationText]; } - (void)updateElapsedTimeLabel:(NSTimeInterval)seconds @@ -436,8 +436,8 @@ static void *ASVideoPlayerNodeContext = &ASVideoPlayerNodeContext; if (!_elapsedTextNode) { return; } - NSString *formatteElapsed = [self timeStringForCMTime:CMTimeMakeWithSeconds( seconds, _videoNode.periodicTimeObserverTimescale ) forTimeLabelType:ASVideoPlayerNodeControlTypeElapsedText]; - _elapsedTextNode.attributedString = [self timeLabelAttributedStringForString:formatteElapsed forControlType:ASVideoPlayerNodeControlTypeElapsedText]; + NSString *formattedElapsed = [self timeStringForCMTime:CMTimeMakeWithSeconds( seconds, _videoNode.periodicTimeObserverTimescale ) forTimeLabelType:ASVideoPlayerNodeControlTypeElapsedText]; + _elapsedTextNode.attributedText = [self timeLabelAttributedStringForString:formattedElapsed forControlType:ASVideoPlayerNodeControlTypeElapsedText]; } - (NSAttributedString*)timeLabelAttributedStringForString:(NSString*)string forControlType:(ASVideoPlayerNodeControlType)controlType diff --git a/AsyncDisplayKit/AsyncDisplayKit+Debug.m b/AsyncDisplayKit/AsyncDisplayKit+Debug.m index e456ce72f6..b012d3e23b 100644 --- a/AsyncDisplayKit/AsyncDisplayKit+Debug.m +++ b/AsyncDisplayKit/AsyncDisplayKit+Debug.m @@ -704,7 +704,7 @@ static BOOL __shouldShowRangeDebugOverlay = NO; _debugString = [[_rangeController dataSource] nameForRangeControllerDataSource]; } if (_debugString) { - _debugText.attributedString = [_ASRangeDebugBarView whiteAttributedStringFromString:_debugString withSize:size]; + _debugText.attributedText = [_ASRangeDebugBarView whiteAttributedStringFromString:_debugString withSize:size]; } if (ASScrollDirectionContainsVerticalDirection(_scrollDirection)) { diff --git a/examples/ASCollectionView/Sample/SupplementaryNode.m b/examples/ASCollectionView/Sample/SupplementaryNode.m index fb5783565e..af5977711f 100644 --- a/examples/ASCollectionView/Sample/SupplementaryNode.m +++ b/examples/ASCollectionView/Sample/SupplementaryNode.m @@ -34,7 +34,7 @@ static CGFloat kInsets = 15.0; self = [super init]; if (self != nil) { _textNode = [[ASTextNode alloc] init]; - _textNode.attributedString = [[NSAttributedString alloc] initWithString:text + _textNode.attributedText = [[NSAttributedString alloc] initWithString:text attributes:[self textAttributes]]; [self addSubnode:_textNode]; } diff --git a/examples/ASDKgram/Sample/PhotoCellNode.m b/examples/ASDKgram/Sample/PhotoCellNode.m index 082ecbf46f..bbb3cbd468 100644 --- a/examples/ASDKgram/Sample/PhotoCellNode.m +++ b/examples/ASDKgram/Sample/PhotoCellNode.m @@ -70,7 +70,7 @@ _photoImageView.layerBacked = YES; _userNameLabel = [[ASTextNode alloc] init]; - _userNameLabel.attributedString = [photo.ownerUserProfile usernameAttributedStringWithFontSize:FONT_SIZE]; + _userNameLabel.attributedText = [photo.ownerUserProfile usernameAttributedStringWithFontSize:FONT_SIZE]; _photoLocationLabel = [[ASTextNode alloc] init]; _photoLocationLabel.maximumNumberOfLines = 1; @@ -80,7 +80,7 @@ // make sure to use _photoModel instance variable as photo may change when cell is reused, // where as local variable will never change if (locationModel == _photoModel.location) { - _photoLocationLabel.attributedString = [photo locationAttributedStringWithFontSize:FONT_SIZE]; + _photoLocationLabel.attributedText = [photo locationAttributedStringWithFontSize:FONT_SIZE]; [self setNeedsLayout]; } }]; @@ -181,7 +181,7 @@ { ASTextNode *textNode = [[ASTextNode alloc] init]; textNode.layerBacked = YES; - textNode.attributedString = attributedString; + textNode.attributedText = attributedString; return textNode; } diff --git a/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m b/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m index 2734bb5265..853b2ecc97 100644 --- a/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m +++ b/examples/AsyncDisplayKitOverview/Sample/OverviewComponentsViewController.m @@ -79,7 +79,7 @@ typedef ASLayoutSpec *(^OverviewDisplayNodeSizeThatFitsBlock)(ASSizeRange constr - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize { - BOOL hasDescription = self.descriptionNode.attributedString.length > 0; + BOOL hasDescription = self.descriptionNode.attributedText.length > 0; ASStackLayoutSpec *verticalStackLayoutSpec = [ASStackLayoutSpec verticalStackLayoutSpec]; verticalStackLayoutSpec.spacing = 5.0; @@ -184,7 +184,7 @@ typedef ASLayoutSpec *(^OverviewDisplayNodeSizeThatFitsBlock)(ASSizeRange constr #pragma mark ASTextNode ASTextNode *textNode = [ASTextNode new]; - textNode.attributedString = [[NSAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum varius nisi quis mattis dignissim. Proin convallis odio nec ipsum molestie, in porta quam viverra. Fusce ornare dapibus velit, nec malesuada mauris pretium vitae. Etiam malesuada ligula magna."]; + textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum varius nisi quis mattis dignissim. Proin convallis odio nec ipsum molestie, in porta quam viverra. Fusce ornare dapibus velit, nec malesuada mauris pretium vitae. Etiam malesuada ligula magna."]; parentNode = [self centeringParentNodeWithChild:textNode]; parentNode.entryTitle = @"ASTextNode"; @@ -529,11 +529,11 @@ typedef ASLayoutSpec *(^OverviewDisplayNodeSizeThatFitsBlock)(ASSizeRange constr NSFontAttributeName : [UIFont boldSystemFontOfSize:14.0], NSForegroundColorAttributeName : [UIColor blackColor] }; - cellNode.titleNode.attributedString = [[NSAttributedString alloc] initWithString:node.entryTitle attributes:titleNodeAttributes]; + cellNode.titleNode.attributedText = [[NSAttributedString alloc] initWithString:node.entryTitle attributes:titleNodeAttributes]; if (node.entryDescription) { NSDictionary *descriptionNodeAttributes = @{NSForegroundColorAttributeName : [UIColor lightGrayColor]}; - cellNode.descriptionNode.attributedString = [[NSAttributedString alloc] initWithString:node.entryDescription attributes:descriptionNodeAttributes]; + cellNode.descriptionNode.attributedText = [[NSAttributedString alloc] initWithString:node.entryDescription attributes:descriptionNodeAttributes]; } return cellNode; diff --git a/examples/CatDealsCollectionView/Sample/BlurbNode.m b/examples/CatDealsCollectionView/Sample/BlurbNode.m index c39d5ef0da..262b860184 100644 --- a/examples/CatDealsCollectionView/Sample/BlurbNode.m +++ b/examples/CatDealsCollectionView/Sample/BlurbNode.m @@ -72,7 +72,7 @@ static CGFloat kTextPadding = 10.0f; NSForegroundColorAttributeName: [UIColor blueColor], NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot), } range:[blurb rangeOfString:@"catipsum.com"]]; - _textNode.attributedString = string; + _textNode.attributedText = string; // add it as a subnode, and we're done [self addSubnode:_textNode]; diff --git a/examples/CatDealsCollectionView/Sample/ItemNode.m b/examples/CatDealsCollectionView/Sample/ItemNode.m index 34da74cfbc..8515cc8f49 100644 --- a/examples/CatDealsCollectionView/Sample/ItemNode.m +++ b/examples/CatDealsCollectionView/Sample/ItemNode.m @@ -152,33 +152,33 @@ const CGFloat kSoldOutGBHeight = 50.0; - (void)updateLabels { // Set Title text if (self.viewModel.titleText) { - self.titleLabel.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.titleText attributes:[ItemStyles titleStyle]]; + self.titleLabel.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.titleText attributes:[ItemStyles titleStyle]]; } if (self.viewModel.firstInfoText) { - self.firstInfoLabel.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.firstInfoText attributes:[ItemStyles subtitleStyle]]; + self.firstInfoLabel.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.firstInfoText attributes:[ItemStyles subtitleStyle]]; } if (self.viewModel.secondInfoText) { - self.secondInfoLabel.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.secondInfoText attributes:[ItemStyles secondInfoStyle]]; + self.secondInfoLabel.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.secondInfoText attributes:[ItemStyles secondInfoStyle]]; } if (self.viewModel.originalPriceText) { - self.originalPriceLabel.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.originalPriceText attributes:[ItemStyles originalPriceStyle]]; + self.originalPriceLabel.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.originalPriceText attributes:[ItemStyles originalPriceStyle]]; } if (self.viewModel.finalPriceText) { - self.finalPriceLabel.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.finalPriceText attributes:[ItemStyles finalPriceStyle]]; + self.finalPriceLabel.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.finalPriceText attributes:[ItemStyles finalPriceStyle]]; } if (self.viewModel.distanceLabelText) { NSString *format = [ItemNode isRTL] ? @"%@ •" : @"• %@"; NSString *distanceText = [NSString stringWithFormat:format, self.viewModel.distanceLabelText]; - self.distanceLabel.attributedString = [[NSAttributedString alloc] initWithString:distanceText attributes:[ItemStyles distanceStyle]]; + self.distanceLabel.attributedText = [[NSAttributedString alloc] initWithString:distanceText attributes:[ItemStyles distanceStyle]]; } BOOL isSoldOut = self.viewModel.soldOutText != nil; if (isSoldOut) { NSString *soldOutText = self.viewModel.soldOutText; - self.soldOutLabelFlat.attributedString = [[NSAttributedString alloc] initWithString:soldOutText attributes:[ItemStyles soldOutStyle]]; + self.soldOutLabelFlat.attributedText = [[NSAttributedString alloc] initWithString:soldOutText attributes:[ItemStyles soldOutStyle]]; } self.soldOutOverlay.hidden = !isSoldOut; self.soldOutLabelFlat.hidden = !isSoldOut; @@ -186,7 +186,7 @@ const CGFloat kSoldOutGBHeight = 50.0; BOOL hasBadge = self.viewModel.badgeText != nil; if (hasBadge) { - self.badge.attributedString = [[NSAttributedString alloc] initWithString:self.viewModel.badgeText attributes:[ItemStyles badgeStyle]]; + self.badge.attributedText = [[NSAttributedString alloc] initWithString:self.viewModel.badgeText attributes:[ItemStyles badgeStyle]]; self.badge.backgroundColor = [ItemStyles badgeColor]; } self.badge.hidden = !hasBadge; diff --git a/examples/Kittens/Sample/BlurbNode.m b/examples/Kittens/Sample/BlurbNode.m index 4f580098ff..7b02ae93de 100644 --- a/examples/Kittens/Sample/BlurbNode.m +++ b/examples/Kittens/Sample/BlurbNode.m @@ -63,7 +63,7 @@ static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName"; NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot), } range:[blurb rangeOfString:@"placekitten.com"]]; - _textNode.attributedString = string; + _textNode.attributedText = string; // add it as a subnode, and we're done [self addSubnode:_textNode]; diff --git a/examples/Kittens/Sample/KittenNode.mm b/examples/Kittens/Sample/KittenNode.mm index f030681c97..e97ef637ff 100644 --- a/examples/Kittens/Sample/KittenNode.mm +++ b/examples/Kittens/Sample/KittenNode.mm @@ -98,7 +98,7 @@ static const CGFloat kInnerPadding = 10.0f; // lorem ipsum text, plus some nice styling _textNode = [[ASTextNode alloc] init]; - _textNode.attributedString = [[NSAttributedString alloc] initWithString:[self kittyIpsum] + _textNode.attributedText = [[NSAttributedString alloc] initWithString:[self kittyIpsum] attributes:[self textStyle]]; [self addSubnode:_textNode]; diff --git a/examples/SocialAppLayout/Sample/CommentsNode.m b/examples/SocialAppLayout/Sample/CommentsNode.m index a9d76093ca..de1a009945 100644 --- a/examples/SocialAppLayout/Sample/CommentsNode.m +++ b/examples/SocialAppLayout/Sample/CommentsNode.m @@ -38,7 +38,7 @@ _countNode = [[ASTextNode alloc] init]; if (_commentsCount > 0) { - _countNode.attributedString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%zd", _commentsCount] attributes:[TextStyles cellControlStyle]]; + _countNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%zd", _commentsCount] attributes:[TextStyles cellControlStyle]]; } [self addSubnode:_countNode]; diff --git a/examples/SocialAppLayout/Sample/LikesNode.m b/examples/SocialAppLayout/Sample/LikesNode.m index 6733f2af8c..c0d9d78ee7 100644 --- a/examples/SocialAppLayout/Sample/LikesNode.m +++ b/examples/SocialAppLayout/Sample/LikesNode.m @@ -42,7 +42,7 @@ if (_likesCount > 0) { NSDictionary *attributes = _liked ? [TextStyles cellControlColoredStyle] : [TextStyles cellControlStyle]; - _countNode.attributedString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld", (long)_likesCount] attributes:attributes]; + _countNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%ld", (long)_likesCount] attributes:attributes]; } [self addSubnode:_countNode]; diff --git a/examples/SocialAppLayout/Sample/PostNode.m b/examples/SocialAppLayout/Sample/PostNode.m index df6915afd6..9187999602 100644 --- a/examples/SocialAppLayout/Sample/PostNode.m +++ b/examples/SocialAppLayout/Sample/PostNode.m @@ -52,13 +52,13 @@ // Name node _nameNode = [[ASTextNode alloc] init]; - _nameNode.attributedString = [[NSAttributedString alloc] initWithString:_post.name attributes:[TextStyles nameStyle]]; + _nameNode.attributedText = [[NSAttributedString alloc] initWithString:_post.name attributes:[TextStyles nameStyle]]; _nameNode.maximumNumberOfLines = 1; [self addSubnode:_nameNode]; // Username node _usernameNode = [[ASTextNode alloc] init]; - _usernameNode.attributedString = [[NSAttributedString alloc] initWithString:_post.username attributes:[TextStyles usernameStyle]]; + _usernameNode.attributedText = [[NSAttributedString alloc] initWithString:_post.username attributes:[TextStyles usernameStyle]]; _usernameNode.flexShrink = YES; //if name and username don't fit to cell width, allow username shrink _usernameNode.truncationMode = NSLineBreakByTruncatingTail; _usernameNode.maximumNumberOfLines = 1; @@ -66,7 +66,7 @@ // Time node _timeNode = [[ASTextNode alloc] init]; - _timeNode.attributedString = [[NSAttributedString alloc] initWithString:_post.time attributes:[TextStyles timeStyle]]; + _timeNode.attributedText = [[NSAttributedString alloc] initWithString:_post.time attributes:[TextStyles timeStyle]]; [self addSubnode:_timeNode]; // Post node @@ -98,7 +98,7 @@ _postNode.delegate = self; _postNode.userInteractionEnabled = YES; _postNode.linkAttributeNames = @[ kLinkAttributeName ]; - _postNode.attributedString = attrString; + _postNode.attributedText = attrString; _postNode.passthroughNonlinkTouches = YES; // passes touches through when they aren't on a link } diff --git a/examples/Swift/Sample/TailLoadingCellNode.swift b/examples/Swift/Sample/TailLoadingCellNode.swift index f4210ca509..6defdbd293 100644 --- a/examples/Swift/Sample/TailLoadingCellNode.swift +++ b/examples/Swift/Sample/TailLoadingCellNode.swift @@ -27,7 +27,7 @@ final class TailLoadingCellNode: ASCellNode { override init() { super.init() addSubnode(text) - text.attributedString = NSAttributedString( + text.attributedText = NSAttributedString( string: "Loading…", attributes: [ NSFontAttributeName: UIFont.systemFontOfSize(12), diff --git a/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m b/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m index 52f72a0f01..321d04d4b2 100644 --- a/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m +++ b/examples/VerticalWithinHorizontalScrolling/Sample/RandomCoreGraphicsNode.m @@ -68,7 +68,7 @@ - (void)setIndexPath:(NSIndexPath *)indexPath { _indexPath = indexPath; - _indexPathTextNode.attributedString = [[NSAttributedString alloc] initWithString:[indexPath description] attributes:nil]; + _indexPathTextNode.attributedText = [[NSAttributedString alloc] initWithString:[indexPath description] attributes:nil]; } //- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize diff --git a/examples_extra/ASTraitCollection/Sample/KittenNode.m b/examples_extra/ASTraitCollection/Sample/KittenNode.m index a7f95e91fb..d6ac688bfe 100644 --- a/examples_extra/ASTraitCollection/Sample/KittenNode.m +++ b/examples_extra/ASTraitCollection/Sample/KittenNode.m @@ -89,7 +89,7 @@ static const CGFloat kInnerPadding = 10.0f; // lorem ipsum text, plus some nice styling _textNode = [[ASTextNode alloc] init]; - _textNode.attributedString = [[NSAttributedString alloc] initWithString:[self kittyIpsum] + _textNode.attributedText = [[NSAttributedString alloc] initWithString:[self kittyIpsum] attributes:[self textStyle]]; _textNode.flexShrink = YES; _textNode.flexGrow = YES; diff --git a/examples_extra/ASTraitCollection/Sample/OverrideViewController.m b/examples_extra/ASTraitCollection/Sample/OverrideViewController.m index f150bc317d..1b16fe9975 100644 --- a/examples_extra/ASTraitCollection/Sample/OverrideViewController.m +++ b/examples_extra/ASTraitCollection/Sample/OverrideViewController.m @@ -66,7 +66,7 @@ static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName"; } range:[blurb rangeOfString:@"placekitten.com"]]; - _textNode.attributedString = string; + _textNode.attributedText = string; ASStackLayoutSpec *stackSpec = [ASStackLayoutSpec verticalStackLayoutSpec]; stackSpec.children = @[_textNode, _buttonNode]; diff --git a/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m b/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m index 25a6cc4fc8..91ae544fdd 100644 --- a/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m +++ b/examples_extra/CarthageBuildTest/CarthageExample/ViewController.m @@ -34,7 +34,7 @@ dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ ASTextNode *node = [[ASTextNode alloc] init]; - node.attributedString = [[NSAttributedString alloc] initWithString:@"hello world"]; + node.attributedText = [[NSAttributedString alloc] initWithString:@"hello world"]; [node measure:(CGSize){.width = screenSize.width, .height = CGFLOAT_MAX}]; node.frame = (CGRect) {.origin = (CGPoint){.x = 100, .y = 100}, .size = node.calculatedSize }; diff --git a/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m b/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m index c006b70fb2..ab3be7cd4d 100644 --- a/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m +++ b/examples_extra/CollectionViewWithViewControllerCells/Sample/SupplementaryNode.m @@ -30,7 +30,7 @@ self = [super init]; if (self != nil) { _textNode = [[ASTextNode alloc] init]; - _textNode.attributedString = [[NSAttributedString alloc] initWithString:text + _textNode.attributedText = [[NSAttributedString alloc] initWithString:text attributes:[self textAttributes]]; [self addSubnode:_textNode]; } diff --git a/examples_extra/EditableText/Sample/ViewController.m b/examples_extra/EditableText/Sample/ViewController.m index 9e6eceb782..6bbcad75cd 100644 --- a/examples_extra/EditableText/Sample/ViewController.m +++ b/examples_extra/EditableText/Sample/ViewController.m @@ -69,7 +69,7 @@ _node = [[ASTextNode alloc] init]; _node.maximumNumberOfLines = 3; _node.backgroundColor = [UIColor lightGrayColor]; - _node.attributedString = string; + _node.attributedText = string; _node.frame = CGRectMake(70, 400, 40, 100); // [_node measure:CGSizeMake(40, 50)]; No longer needed now that https://github.com/facebook/AsyncDisplayKit/issues/1295 is fixed. diff --git a/examples_extra/Multiplex/Sample/ScreenNode.m b/examples_extra/Multiplex/Sample/ScreenNode.m index 6471b39737..06ae9e7dcc 100644 --- a/examples_extra/Multiplex/Sample/ScreenNode.m +++ b/examples_extra/Multiplex/Sample/ScreenNode.m @@ -115,7 +115,7 @@ [self setText:[NSString stringWithFormat:@"loaded '%@'", imageIdentifier]]; if ([imageIdentifier isEqualToString:@"best"]) { - [self setText:[_buttonNode.titleNode.attributedString.string stringByAppendingString:@". tap to reload"]]; + [self setText:[_buttonNode.titleNode.attributedText.string stringByAppendingString:@". tap to reload"]]; _buttonNode.userInteractionEnabled = YES; } } diff --git a/examples_extra/Placeholders/Sample/PostNode.m b/examples_extra/Placeholders/Sample/PostNode.m index 438430547a..7d4a5c2c8b 100644 --- a/examples_extra/Placeholders/Sample/PostNode.m +++ b/examples_extra/Placeholders/Sample/PostNode.m @@ -52,7 +52,7 @@ NSString *text = @"Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Etiam porta sem malesuada magna mollis euismod. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh."; NSDictionary *attributes = @{ NSFontAttributeName: [UIFont systemFontOfSize:17.0] }; - _textNode.attributedString = [[NSAttributedString alloc] initWithString:text attributes:attributes]; + _textNode.attributedText = [[NSAttributedString alloc] initWithString:text attributes:attributes]; _needyChildNode = [[SlowpokeShareNode alloc] init]; _needyChildNode.opaque = NO; diff --git a/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m b/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m index 70e07b95eb..f6a94959a7 100644 --- a/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m +++ b/examples_extra/SynchronousConcurrency/Sample/RandomCoreGraphicsNode.m @@ -77,7 +77,7 @@ _textNode = [[ASTextNode alloc] init]; _textNode.placeholderEnabled = NO; - _textNode.attributedString = [[NSAttributedString alloc] initWithString:@"Hello, ASDK!" + _textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Hello, ASDK!" attributes:[self textStyle]]; [self addSubnode:_textNode]; diff --git a/examples_extra/SynchronousKittens/Sample/BlurbNode.m b/examples_extra/SynchronousKittens/Sample/BlurbNode.m index 4f580098ff..7b02ae93de 100644 --- a/examples_extra/SynchronousKittens/Sample/BlurbNode.m +++ b/examples_extra/SynchronousKittens/Sample/BlurbNode.m @@ -63,7 +63,7 @@ static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName"; NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot), } range:[blurb rangeOfString:@"placekitten.com"]]; - _textNode.attributedString = string; + _textNode.attributedText = string; // add it as a subnode, and we're done [self addSubnode:_textNode]; diff --git a/examples_extra/SynchronousKittens/Sample/KittenNode.mm b/examples_extra/SynchronousKittens/Sample/KittenNode.mm index e3be59ed25..bf151fd837 100644 --- a/examples_extra/SynchronousKittens/Sample/KittenNode.mm +++ b/examples_extra/SynchronousKittens/Sample/KittenNode.mm @@ -97,7 +97,7 @@ static const CGFloat kInnerPadding = 10.0f; // lorem ipsum text, plus some nice styling _textNode = [[ASTextNode alloc] init]; - _textNode.attributedString = [[NSAttributedString alloc] initWithString:[self kittyIpsum] + _textNode.attributedText = [[NSAttributedString alloc] initWithString:[self kittyIpsum] attributes:[self textStyle]]; [self addSubnode:_textNode]; diff --git a/examples_extra/VideoTableView/Sample/BlurbNode.m b/examples_extra/VideoTableView/Sample/BlurbNode.m index f6f24cbbba..36dea1ecae 100644 --- a/examples_extra/VideoTableView/Sample/BlurbNode.m +++ b/examples_extra/VideoTableView/Sample/BlurbNode.m @@ -56,7 +56,7 @@ static NSString *kLinkAttributeName = @"PlaceKittenNodeLinkAttributeName"; // generate an attributed string using the custom link attribute specified above NSString *blurb = @"Nic Cage courtesy of himself."; NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:blurb]; - _textNode.attributedString = string; + _textNode.attributedText = string; // add it as a subnode, and we're done [self addSubnode:_textNode]; diff --git a/examples_extra/VideoTableView/Sample/NicCageNode.mm b/examples_extra/VideoTableView/Sample/NicCageNode.mm index 367d4967e6..cb6802229f 100644 --- a/examples_extra/VideoTableView/Sample/NicCageNode.mm +++ b/examples_extra/VideoTableView/Sample/NicCageNode.mm @@ -122,7 +122,7 @@ static const CGFloat kInnerPadding = 10.0f; [self addSubnode:_videoNode]; _textNode = [[ASTextNode alloc] init]; - _textNode.attributedString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@ %@", methodArray[videoInitMethod], autoPlayArray[autoPlay], [self kittyIpsum]] + _textNode.attributedText = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@ %@ %@", methodArray[videoInitMethod], autoPlayArray[autoPlay], [self kittyIpsum]] attributes:[self textStyle]]; [self addSubnode:_textNode]; diff --git a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.m b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.m index 9d7af84d65..761d164c28 100644 --- a/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.m +++ b/smoke-tests/Life Without CocoaPods/Life Without CocoaPods/ViewController.m @@ -21,7 +21,7 @@ - (void)viewDidLoad { self.textNode = [[ASTextNode alloc] init]; - self.textNode.attributedString = [[NSAttributedString alloc] initWithString:@"Testing, testing." attributes:@{ NSForegroundColorAttributeName: [UIColor redColor] }]; + self.textNode.attributedText = [[NSAttributedString alloc] initWithString:@"Testing, testing." attributes:@{ NSForegroundColorAttributeName: [UIColor redColor] }]; [self.textNode measure:self.view.bounds.size]; self.textNode.frame = (CGRect){ .origin = CGPointZero, .size = self.textNode.calculatedSize }; [self.view addSubnode:self.textNode];