This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import AsyncDisplayKit | |
| class ActionNode: ASDisplayNode { | |
| // MARK: - Nodes | |
| private let loveButton: ASImageNode | |
| private let commentButton: ASImageNode | |
| private let shareButton: ASImageNode | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import AsyncDisplayKit | |
| class HeaderNode: ASDisplayNode { | |
| // MARK: - Values | |
| private let post: Post | |
| // MARK: - Nodes | |
| private let profilePicture: ASImageNode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let wrapper = ASWrapperLayoutSpec(layoutElement: self.titleNode) | |
| return wrapper |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Texture Containers | UIKit Equivalent | |
|---|---|---|
| ASCollectionNode | UICollectionView | |
| ASPagerNode | UIPageViewController | |
| ASTableNode | UITableViewController | |
| ASViewController | UIViewController |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Texture Components | UIKit Components | |
|---|---|---|
| ASDisplayNode | UIView | |
| ASImageNode | UIImageView | |
| ASButtonNode | UIButton | |
| ASControlNode | UIControl | |
| ASCellNode | UITableViewCell / UICollectionViewCell | |
| ASScrollNode | UIScrollView | |
| ASEditableTextNode | UITextView | |
| ASTextNode | UILabel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node.style.layoutPosition = CGPoint(x: 0.0, y: maxConstrainedSize.height / 3.0) | |
| node.style.preferredSize = CGSize(width: maxConstrainedSize.width / 2.0, height: maxConstrainedSize.height / 3.0) | |
| return ASAbsoluteLayoutSpec(children: [node]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let relativeSpec = ASRelativeLayoutSpec(horizontalPosition: .start, | |
| verticalPosition: .start, | |
| sizingOption: [], | |
| child: foregroundNode) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let subnode = ASDisplayNodeWithBackgroundColor(UIColor.green, CGSize(width: 100, height: 100.0)) | |
| let ratioSpec = ASRatioLayoutSpec(ratio: 0.5, child: subnode) | |
| return ratioSpec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let center = ASCenterLayoutSpec(centeringOptions: .XY, | |
| sizingOptions: .minimumXY, | |
| child: mainStack) | |
| return center |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let backgroundNode = ASDisplayNodeWithBackgroundColor(UIColor.red) | |
| let foregroundNode = ASDisplayNodeWithBackgroundColor(UIColor.blue) | |
| return ASBackgroundLayoutSpec(child: foregroundNode, background: backgroundNode) |