Guest User

Untitled

a guest
Jul 20th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
  2. let contentLayout = contentLayoutSpec()
  3. contentLayout.style.flexShrink = 1.0
  4. contentLayout.style.flexGrow = 1.0
  5.  
  6. userProfileNode.style.flexShrink = 1.0
  7. userProfileNode.style.flexGrow = 0.0
  8.  
  9. let stackLayout = ASStackLayoutSpec(direction: .horizontal,
  10. spacing: 10.0,
  11. justifyContent: .start,
  12. alignItems: .center,
  13. children: [userProfileNode,
  14. contentLayout])
  15.  
  16. return ASInsetLayoutSpec(insets: UIEdgeInsets(top: 10.0,
  17. left: 10.0,
  18. bottom: 10.0,
  19. right: 10.0),
  20. child: stackLayout)
  21. }
  22.  
  23. private func contentLayoutSpec() -> ASLayoutSpec {
  24. let elements = [self.usernameNode,
  25. self.descriptionNode,
  26. self.statusNode].filter { $0.attributedText?.length ?? 0 > 0 }
  27.  
  28. return ASStackLayoutSpec(direction: .vertical,
  29. spacing: 5.0,
  30. justifyContent: .spaceAround,
  31. alignItems: .stretch,
  32. children: elements)
  33. }
Add Comment
Please, Sign In to add comment