diff --git a/docs/_docs/automatic-subnode-mgmt.md b/docs/_docs/automatic-subnode-mgmt.md index 7432c180c..8ef16a6b6 100755 --- a/docs/_docs/automatic-subnode-mgmt.md +++ b/docs/_docs/automatic-subnode-mgmt.md @@ -14,14 +14,16 @@ When enabled, ASM means that your nodes no longer require `addSubnode:` or `remo
Consider the following intialization method from the PhotoCellNode class in ASDKgram sample app. This ASCellNode subclass produces a simple social media photo feed cell. -In the "Original Code" we see the familiar `addSubnode:` calls in bold. In the "Code with ASM" (switch at top right of code block) these have been removed and replaced with a single line that enables ASM. +In the "Original Code" we see the familiar `addSubnode:` calls in bold. In the "Code with ASM" these have been removed and replaced with a single line that enables ASM. By setting `.automaticallyManagesSubnodes` to `YES` on the `ASCellNode`, we _no longer_ need to call `addSubnode:` for each of the `ASCellNode`'s subnodes. These `subNodes` will be present in the node hierarchy as long as this class' `layoutSpecThatFits:` method includes them. -
+ +Original code +
- Code with ASM - Original Code + Objective-C + Swift
@@ -57,8 +59,50 @@ By setting `.automaticallyManagesSubnodes` to `YES` on the `ASCellNode`, we _no
   return self;
 }
 
+
+
+ +Code with ASM +
+ + Objective-C + Swift + +
+
 - (instancetype)initWithPhotoObject:(PhotoModel *)photo;
 {
   self = [super init];
@@ -89,6 +133,37 @@ By setting `.automaticallyManagesSubnodes` to `YES` on the `ASCellNode`, we _no
   return self;
 }
 
+
@@ -105,7 +180,10 @@ An ASLayoutSpec completely describes the UI of a view in your app b Consider the abreviated `layoutSpecThatFits:` method for the `ASCellNode` subclass above.
-SwiftObjective-C + +Objective-C +Swift +
@@ -153,7 +231,47 @@ Consider the abreviated `layoutSpecThatFits:` method for the `ASCellNode` subcla
 
diff --git a/docs/_docs/button-node.md b/docs/_docs/button-node.md index 2dcbd030e..11eb6ca95 100755 --- a/docs/_docs/button-node.md +++ b/docs/_docs/button-node.md @@ -22,7 +22,7 @@ If you've used `-setTitle:forControlState:` then you already know how to set up [buttonNode setTitle:@"Button Title Normal" withFont:nil withColor:[UIColor blueColor] forState:ASControlStateNormal];
@@ -37,7 +37,7 @@ If you need even more control, you can also opt to use the attributed string ver [self.buttonNode setAttributedTitle:attributedTitle forState:ASControlStateNormal]; @@ -54,7 +54,7 @@ Again, analagous to UIKit, you can add sets of target-action pairs to respond to [buttonNode addTarget:self action:@selector(buttonPressed:) forControlEvents:ASControlNodeEventTouchUpInside]; @@ -72,8 +72,8 @@ self.buttonNode.contentVerticalAlignment = ASVerticalAlignmentTop; self.buttonNode.contentHorizontalAlignment = ASHorizontalAlignmentMiddle; diff --git a/docs/_docs/cell-node.md b/docs/_docs/cell-node.md index 85c626a8d..5bf99b5ee 100755 --- a/docs/_docs/cell-node.md +++ b/docs/_docs/cell-node.md @@ -42,20 +42,20 @@ For example, say you already have a view controller written that manages an `AST return [[AnimalTableNodeController alloc] initWithAnimals:animals]; } didLoadBlock:nil]; - node.preferredFrameSize = pagerNode.bounds.size; + node.style.preferredSize = pagerNode.bounds.size; return node; } @@ -102,7 +120,22 @@ Next, we add a mutable array to the `PhotoFeedNodeController` to store our node @@ -140,7 +173,25 @@ To use this node controller, we modify our table row insertion logic to create a @@ -169,7 +220,16 @@ Don't forget to modify the table data source method to return the node controlle diff --git a/docs/_docs/containers-astablenode.md b/docs/_docs/containers-astablenode.md index 509b58ce0..8227da117 100755 --- a/docs/_docs/containers-astablenode.md +++ b/docs/_docs/containers-astablenode.md @@ -22,7 +22,7 @@ nextPage: containers-ascollectionnode.html @@ -41,7 +41,7 @@ with your choice of **_one_** of the following methods @@ -60,14 +60,14 @@ or
-It is recommended that you use the node block version of these methods so that your collection node will be able to prepare and display all of its cells concurrently. This means that all subnode initialization methods can be run in the background. Make sure to keep 'em thread safe. +It is recommended that you use the node block version of these methods so that your table node will be able to prepare and display all of its cells concurrently. This means that all subnode initialization methods can be run in the background. Make sure to keep 'em thread safe.
These two methods, need to return either an `ASCellNode` or an `ASCellNodeBlock`. An `ASCellNodeBlock` is a block that creates a `ASCellNode` which can be run on a background thread. Note that `ASCellNodes` are used by `ASTableNode`, `ASCollectionNode` and `ASPagerNode`. @@ -101,10 +101,10 @@ An `ASTableNode` is assigned to be managed by an `ASViewController` in its `-ini +In the example above, you can see how the index is used to access the photo model before creating the node block. ### Accessing the ASTableView @@ -194,7 +193,7 @@ override func viewDidLoad() { super.viewDidLoad() tableNode.view.allowsSelection = false - tableNode.view.separatorStyle = .None + tableNode.view.separatorStyle = .none tableNode.view.leadingScreensForBatching = 3.0 // default is 2.0 } diff --git a/docs/_docs/debug-tool-ASRangeController.md b/docs/_docs/debug-tool-ASRangeController.md index 38fc48023..fcc2d124d 100755 --- a/docs/_docs/debug-tool-ASRangeController.md +++ b/docs/_docs/debug-tool-ASRangeController.md @@ -36,7 +36,7 @@ The Automatic Subnode Management. -Nodes are inserted before your implementation of `animateLayoutTransition:` is called and this is a good place to manually manage the hierarchy before you begin the animation. Removals are preformed in `didCompleteLayoutTransition:` after you call `completeTransition:` on the context object. If you need to manually perform deletions, override `didCompleteLayoutTransition:` and perform your custom operations. Note that this will override the default behavior and it is recommended to either call `super` or walk through the `removedSubnodes` getter in the context object to perform the cleanup. +Nodes are inserted before your implementation of `animateLayoutTransition:` is called and this is a good place to manually manage the hierarchy before you begin the animation. Removals are performed in `didCompleteLayoutTransition:` after you call `completeTransition:` on the context object. If you need to manually perform deletions, override `didCompleteLayoutTransition:` and perform your custom operations. Note that this will override the default behavior and it is recommended to either call `super` or walk through the `removedSubnodes` getter in the context object to perform the cleanup. Passing `NO` to `transitionLayoutWithAnimation:` will still run through your `animateLayoutTransition:` and `didCompleteLayoutTransition:` implementations with the `[context isAnimated]` property set to `NO`. It is your choice on how to handle this case — if at all. An easy way to provide a default implementation this is to call super: diff --git a/docs/_docs/layout2-conversion-guide.md b/docs/_docs/layout2-conversion-guide.md index 7d120645e..564f2778a 100755 --- a/docs/_docs/layout2-conversion-guide.md +++ b/docs/_docs/layout2-conversion-guide.md @@ -405,10 +405,22 @@ Use `-[ASDisplayNode layoutThatFits:]` instead to get an `ASLayout` and call `si CGSize size = [displayNode measure:CGSizeMake(100, 100)]; // 2.0: -ASLayout *layout = [displayNode layoutThatFits:ASSizeMake(CGSizeZero, CGSizeMake(100, 100))]; +// Creates an ASSizeRange with min and max sizes. +ASLayout *layout = [displayNode layoutThatFits:ASSizeRangeMake(CGSizeZero, CGSizeMake(100, 100))]; +// Or an exact size +// ASLayout *layout = [displayNode layoutThatFits:ASSizeRangeMake(CGSizeMake(100, 100))]; CGSize size = layout.size; diff --git a/docs/_docs/layout2-layoutspec-types.md b/docs/_docs/layout2-layoutspec-types.md index 3e3281c1e..f5ac3ea75 100755 --- a/docs/_docs/layout2-layoutspec-types.md +++ b/docs/_docs/layout2-layoutspec-types.md @@ -85,7 +85,8 @@ they will be resolved again, causing justifyContent and alignItems to be updated Thus, it is preferred to those properties. - `justifyContent`. The amount of space between each child. - `alignItems`. Orientation of children along cross axis. -- `baselineRelativeArrangement`. If `YES` the vertical spacing between two views is measured from the last baseline of the top view to the top of the bottom view. +- `flexWrap`. Whether children are stacked into a single or multiple lines. Defaults to single line. +- `alignContent`. Orientation of lines along cross axis if there are multiple lines.
@@ -130,7 +131,7 @@ override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec
-Flexbox works the same way in AsyncDisplayKit as it does in CSS on the web, with a few exceptions. The defaults are different, there is no `flex` parameter and `flexGrow` and `flexShrink` only supports a boolean value. +Flexbox works the same way in AsyncDisplayKit as it does in CSS on the web, with a few exceptions. For example, the defaults are different and there is no `flex` parameter. See Web Flexbox Differences for more information.
@@ -242,7 +243,7 @@ override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec let backgroundNode = ASDisplayNodeWithBackgroundColor(UIColor.blue) let foregroundNode = ASDisplayNodeWithBackgroundColor(UIColor.red) - return ASBackgroundLayoutSpec(child: backgroundNode, background: backgroundNode) + return ASBackgroundLayoutSpec(child: foregroundNode, background: backgroundNode) } diff --git a/docs/_docs/layout2-quickstart.md b/docs/_docs/layout2-quickstart.md index 11f6a1f1f..96c7726ee 100755 --- a/docs/_docs/layout2-quickstart.md +++ b/docs/_docs/layout2-quickstart.md @@ -30,7 +30,7 @@ AsyncDisplayKit's layout system is centered around two basic concepts: ### Layout Specs -A layout spec, short for "layout specification", has no physical presence. Instead, layout specs act as containers for other layout elements by understanding how these children layout elments relate to each other. +A layout spec, short for "layout specification", has no physical presence. Instead, layout specs act as containers for other layout elements by understanding how these children layout elements relate to each other. AsyncDisplayKit provides several subclasses of `ASLayoutSpec`, from a simple layout specification that insets a single child, to a more complex layout specification that arranges multiple children in varying stack configurations. @@ -62,7 +62,7 @@ Some elements have an "intrinsic size" based on their immediately available cont - `ASTextNode` - `ASButtonNode` -All other nodes either do not have an intrinsic size or lack an intrinsic size until their external resource is loaded. For example, an `ASNetworkImageNode` does not know its size until the image has been downloaded from the URL. These sorts of elments inlcude +All other nodes either do not have an intrinsic size or lack an intrinsic size until their external resource is loaded. For example, an `ASNetworkImageNode` does not know its size until the image has been downloaded from the URL. These sorts of elements include - `ASVideoNode` - `ASVideoPlayerNode` @@ -73,7 +73,7 @@ These nodes that lack an initial intrinsic size must have an initial size set fo ### Layout Debugging -Calling `-asciiArtString` on any `ASDisplayNode` or `ASLayoutSpec` returns an ascii-art representation of the object and its children. Optionally, if you set the `.debugName` on any node or layout spec, that will also included in the ascii art. An example is seen below. +Calling `-asciiArtString` on any `ASDisplayNode` or `ASLayoutSpec` returns an ascii-art representation of the object and its children. Optionally, if you set the `.debugName` on any node or layout spec, that will also be included in the ascii art. An example is seen below.
diff --git a/docs/_docs/layout2-web-flexbox-differences.md b/docs/_docs/layout2-web-flexbox-differences.md index 641e59530..d31285e22 100755 --- a/docs/_docs/layout2-web-flexbox-differences.md +++ b/docs/_docs/layout2-web-flexbox-differences.md @@ -18,4 +18,4 @@ Layoutables don't have a padding or margin property. Instead wrapping a layoutab ### Missing features -Certain features like `flexWrap` on a `ASStackLayoutSpec` are not supported currently. See Layout Properties for the full list of properties that are supported. \ No newline at end of file +Certain features are not supported currently. See Layout Properties for the full list of properties that are supported. diff --git a/docs/_docs/text-node.md b/docs/_docs/text-node.md index 1210a5120..24b1fbaed 100755 --- a/docs/_docs/text-node.md +++ b/docs/_docs/text-node.md @@ -20,7 +20,7 @@ NSDictionary *attrs = @{ NSFontAttributeName: [UIFont fontWithName:@"HelveticaNe NSAttributedString *string = [[NSAttributedString alloc] initWithString:@"Hey, here's some text." attributes:attrs]; _node = [[ASTextNode alloc] init]; -_node.attributedString = string; +_node.attributedText = string;
@@ -46,15 +46,15 @@ In any case where you need your text node to fit into a space that is smaller th
 _textNode = [[ASTextNode alloc] init];
-_textNode.attributedString = string;
-_textNode.truncationAttributedString = [[NSAttributedString alloc] 
+_textNode.attributedText = string;
+_textNode.truncationAttributedText = [[NSAttributedString alloc] 
 												initWithString:@"¶¶¶"];
 
@@ -86,20 +86,22 @@ NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithS NSUnderlineStyleAttributeName: @(NSUnderlineStyleSingle | NSUnderlinePatternDot), } range:[blurb rangeOfString:@"placekitten.com"]]; -_textNode.attributedString = string; +_textNode.attributedText = string; @@ -127,10 +129,11 @@ Conforming to `ASTextNodeDelegate` allows your class to react to various events