Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
- let contentLayout = contentLayoutSpec()
- contentLayout.style.flexShrink = 1.0
- contentLayout.style.flexGrow = 1.0
- userProfileNode.style.flexShrink = 1.0
- userProfileNode.style.flexGrow = 0.0
- let stackLayout = ASStackLayoutSpec(direction: .horizontal,
- spacing: 10.0,
- justifyContent: .start,
- alignItems: .center,
- children: [userProfileNode,
- contentLayout])
- return ASInsetLayoutSpec(insets: UIEdgeInsets(top: 10.0,
- left: 10.0,
- bottom: 10.0,
- right: 10.0),
- child: stackLayout)
- }
- private func contentLayoutSpec() -> ASLayoutSpec {
- let elements = [self.usernameNode,
- self.descriptionNode,
- self.statusNode].filter { $0.attributedText?.length ?? 0 > 0 }
- return ASStackLayoutSpec(direction: .vertical,
- spacing: 5.0,
- justifyContent: .spaceAround,
- alignItems: .stretch,
- children: elements)
- }
Add Comment
Please, Sign In to add comment