Skip to content

Commit 34338ca

Browse files
Hannah TroisiAdlai Holler
authored andcommitted
[Examples] Rename node variables for clarity (facebookarchive#2946)
1 parent 295ed22 commit 34338ca

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

examples/ASDKgram/Sample/PhotoCellNode.m

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
@implementation PhotoCellNode
4545
{
4646
PhotoModel *_photoModel;
47-
CommentsNode *_photoCommentsView;
48-
ASNetworkImageNode *_userAvatarImageView;
49-
ASNetworkImageNode *_photoImageView;
47+
CommentsNode *_photoCommentsNode;
48+
ASNetworkImageNode *_userAvatarImageNode;
49+
ASNetworkImageNode *_photoImageNode;
5050
ASTextNode *_userNameLabel;
5151
ASTextNode *_photoLocationLabel;
5252
ASTextNode *_photoTimeIntervalSincePostLabel;
@@ -64,18 +64,18 @@ - (instancetype)initWithPhotoObject:(PhotoModel *)photo;
6464

6565
_photoModel = photo;
6666

67-
_userAvatarImageView = [[ASNetworkImageNode alloc] init];
68-
_userAvatarImageView.URL = photo.ownerUserProfile.userPicURL; // FIXME: make round
67+
_userAvatarImageNode = [[ASNetworkImageNode alloc] init];
68+
_userAvatarImageNode.URL = photo.ownerUserProfile.userPicURL; // FIXME: make round
6969

7070
// FIXME: autocomplete for this line seems broken
71-
[_userAvatarImageView setImageModificationBlock:^UIImage *(UIImage *image) {
71+
[_userAvatarImageNode setImageModificationBlock:^UIImage *(UIImage *image) {
7272
CGSize profileImageSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT);
7373
return [image makeCircularImageWithSize:profileImageSize];
7474
}];
7575

76-
_photoImageView = [[ASNetworkImageNode alloc] init];
77-
_photoImageView.URL = photo.URL;
78-
_photoImageView.layerBacked = YES;
76+
_photoImageNode = [[ASNetworkImageNode alloc] init];
77+
_photoImageNode.URL = photo.URL;
78+
_photoImageNode.layerBacked = YES;
7979

8080
_userNameLabel = [[ASTextNode alloc] init];
8181
_userNameLabel.attributedText = [photo.ownerUserProfile usernameAttributedStringWithFontSize:FONT_SIZE];
@@ -98,19 +98,19 @@ - (instancetype)initWithPhotoObject:(PhotoModel *)photo;
9898
_photoDescriptionLabel = [self createLayerBackedTextNodeWithString:[photo descriptionAttributedStringWithFontSize:FONT_SIZE]];
9999
_photoDescriptionLabel.maximumNumberOfLines = 3;
100100

101-
_photoCommentsView = [[CommentsNode alloc] init];
101+
_photoCommentsNode = [[CommentsNode alloc] init];
102102

103-
_photoCommentsView.shouldRasterizeDescendants = YES;
103+
_photoCommentsNode.shouldRasterizeDescendants = YES;
104104

105105
// instead of adding everything addSubnode:
106106
self.automaticallyManagesSubnodes = YES;
107107

108108
#if DEBUG_PHOTOCELL_LAYOUT
109-
_userAvatarImageView.backgroundColor = [UIColor greenColor];
109+
_userAvatarImageNode.backgroundColor = [UIColor greenColor];
110110
_userNameLabel.backgroundColor = [UIColor greenColor];
111111
_photoLocationLabel.backgroundColor = [UIColor greenColor];
112112
_photoTimeIntervalSincePostLabel.backgroundColor = [UIColor greenColor];
113-
_photoCommentsView.backgroundColor = [UIColor greenColor];
113+
_photoCommentsNode.backgroundColor = [UIColor greenColor];
114114
_photoDescriptionLabel.backgroundColor = [UIColor greenColor];
115115
_photoLikesLabel.backgroundColor = [UIColor greenColor];
116116
#endif
@@ -133,8 +133,8 @@ - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
133133
headerStack.alignItems = ASStackLayoutAlignItemsCenter;
134134

135135
// Avatar Image, with inset - first thing in the header stack.
136-
_userAvatarImageView.style.preferredSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT);
137-
[headerChildren addObject:[ASInsetLayoutSpec insetLayoutSpecWithInsets:InsetForAvatar child:_userAvatarImageView]];
136+
_userAvatarImageNode.style.preferredSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT);
137+
[headerChildren addObject:[ASInsetLayoutSpec insetLayoutSpecWithInsets:InsetForAvatar child:_userAvatarImageNode]];
138138

139139
// User Name and Photo Location stack is next
140140
ASStackLayoutSpec *userPhotoLocationStack = [ASStackLayoutSpec verticalStackLayoutSpec];
@@ -165,13 +165,13 @@ - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
165165
// Create the last stack before assembling everything: the Footer Stack contains the description and comments.
166166
ASStackLayoutSpec *footerStack = [ASStackLayoutSpec verticalStackLayoutSpec];
167167
footerStack.spacing = VERTICAL_BUFFER;
168-
footerStack.children = @[_photoLikesLabel, _photoDescriptionLabel, _photoCommentsView];
168+
footerStack.children = @[_photoLikesLabel, _photoDescriptionLabel, _photoCommentsNode];
169169

170170
// Main Vertical Stack: contains header, large main photo with fixed aspect ratio, and footer.
171171
ASStackLayoutSpec *verticalStack = [ASStackLayoutSpec verticalStackLayoutSpec];
172172

173173
[verticalChildren addObject:[ASInsetLayoutSpec insetLayoutSpecWithInsets:InsetForHeader child:headerStack]];
174-
[verticalChildren addObject:[ASRatioLayoutSpec ratioLayoutSpecWithRatio :1.0 child:_photoImageView]];
174+
[verticalChildren addObject:[ASRatioLayoutSpec ratioLayoutSpecWithRatio :1.0 child:_photoImageNode]];
175175
[verticalChildren addObject:[ASInsetLayoutSpec insetLayoutSpecWithInsets:InsetForFooter child:footerStack]];
176176

177177
verticalStack.children = verticalChildren;
@@ -204,7 +204,7 @@ - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
204204
[ASInsetLayoutSpec
205205
insetLayoutSpecWithInsets:InsetForAvatar
206206
child:
207-
[_userAvatarImageView styledWithBlock:^(ASLayoutElementStyle *style) {
207+
[_userAvatarImageNode styledWithBlock:^(ASLayoutElementStyle *style) {
208208
style.preferredSize = CGSizeMake(USER_IMAGE_HEIGHT, USER_IMAGE_HEIGHT);
209209
}]
210210
],
@@ -245,7 +245,7 @@ - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
245245
// Center photo with ratio
246246
[ASRatioLayoutSpec
247247
ratioLayoutSpecWithRatio:1.0
248-
child:_photoImageView],
248+
child:_photoImageNode],
249249

250250
// Footer stack with inset
251251
[ASInsetLayoutSpec
@@ -259,7 +259,7 @@ - (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
259259
children:@[
260260
_photoLikesLabel,
261261
_photoDescriptionLabel,
262-
_photoCommentsView
262+
_photoCommentsNode
263263
]]
264264
]
265265
]];
@@ -290,7 +290,7 @@ - (ASTextNode *)createLayerBackedTextNodeWithString:(NSAttributedString *)attrib
290290
- (void)loadCommentsForPhoto:(PhotoModel *)photo
291291
{
292292
if (photo.commentFeed.numberOfItemsInFeed > 0) {
293-
[_photoCommentsView updateWithCommentFeedModel:photo.commentFeed];
293+
[_photoCommentsNode updateWithCommentFeedModel:photo.commentFeed];
294294

295295
[self setNeedsLayout];
296296
}

0 commit comments

Comments
 (0)