mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-03-19 05:43:53 +00:00
* Added Playground-Swift with two example pages. * Added PhotoWithOutsetIconOverlay example. * Added an extra tip in swift playground. * Added HorizontalStackWithSpacer to the swift playground. * Added fileprivate for some global variables. * Added private to the setupNodes functions * Added solutions to common issues.
32 lines
1.1 KiB
Swift
32 lines
1.1 KiB
Swift
import AsyncDisplayKit
|
|
|
|
public class StackLayout: ASDisplayNode, ASPlayground {
|
|
public let titleNode = ASTextNode()
|
|
public let subtitleNode = ASTextNode()
|
|
|
|
override public init() {
|
|
super.init()
|
|
backgroundColor = .white
|
|
|
|
automaticallyManagesSubnodes = true
|
|
setupNodes()
|
|
}
|
|
|
|
private func setupNodes() {
|
|
titleNode.backgroundColor = .blue
|
|
titleNode.attributedText = NSAttributedString.attributedString(string: "Headline!", fontSize: 14, color: .white, firstWordColor: nil)
|
|
|
|
subtitleNode.backgroundColor = .yellow
|
|
subtitleNode.attributedText = NSAttributedString(string: "Lorem ipsum dolor sit amet, sed ex laudem utroque meliore, at cum lucilius vituperata. Ludus mollis consulatu mei eu, esse vocent epicurei sed at. Ut cum recusabo prodesset. Ut cetero periculis sed, mundi senserit est ut. Nam ut sonet mandamus intellegebat, summo voluptaria vim ad.")
|
|
}
|
|
|
|
// This is used to expose this function for overriding in extensions
|
|
override public func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
|
|
return ASLayoutSpec()
|
|
}
|
|
|
|
public func show() {
|
|
display(inRect: .zero)
|
|
}
|
|
}
|