Debug Tool
Texture에서 제공해주는 기본적인 디버깅 툴을 소개합니다.
Last updated
Was this helpful?
Texture에서 제공해주는 기본적인 디버깅 툴을 소개합니다.
Last updated
Was this helpful?
Was this helpful?
import AsyncDisplayKit
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ASControlNode.enableHitTestDebug = true
}let collectionNode = ASCollectionNode()
let preloadParams: ASRangeTuningParameters =
ASRangeTuningParameters(leadingBufferScreenfuls: 1, trailingBufferScreenfuls: 1)
let displayParams: ASRangeTuningParameters =
ASRangeTuningParameters(leadingBufferScreenfuls: 1, trailingBufferScreenfuls: 1)
collectionNode.setTuningParameters(preloadParams, for: .full, rangeType: .preload)
collectionNode.setTuningParameters(displayParams, for: .full, rangeType: .display)import AsyncDisplayKit
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ASDisplayNode.shouldShowRangeDebugOverlay = true
}class SuperNode: ASDisplayNode {
let childNode1: ASButtonNode = {
let node = ASButtonNode()
node.backgroundColor = .red
return node
}()
let childNode2: ASDisplayNode = {
let node = ASDisplayNode()
node.backgroundColor = .blue
return node
}()
override init() {
super.init()
self.automaticallyManagesSubnodes = true
self.backgroundColor = .white
}
override func layoutSpecThatFits(_ constrainedSize: ASSizeRange) -> ASLayoutSpec {
let insets: UIEdgeInsets = .init(top: 50.0, left: 20.0, bottom: 50.0, right: 20.0)
let insetLayout = ASInsetLayoutSpec.init(insets: insets, child: childNode1)
return ASOverlayLayoutSpec.init(child: childNode2, overlay: insetLayout)
}
}
let node = SuperNode()
let output = node.layoutSpecThatFits(ASSizeRangeZero).asciiArtString()
print(output)