Skip to content

Instantly share code, notes, and snippets.

@GeekTree0101
Created July 20, 2018 12:43
Show Gist options
  • Save GeekTree0101/2c6ff8bd0cf0742fd218e8c2b93297e6 to your computer and use it in GitHub Desktop.
Save GeekTree0101/2c6ff8bd0cf0742fd218e8c2b93297e6 to your computer and use it in GitHub Desktop.
aaa
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)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment