Skip to content

Instantly share code, notes, and snippets.

@GeekTree0101
Created June 19, 2020 03:53
Show Gist options
  • Save GeekTree0101/1e18026bdb01790e7811e4769b7a5acd to your computer and use it in GitHub Desktop.
Save GeekTree0101/1e18026bdb01790e7811e4769b7a5acd to your computer and use it in GitHub Desktop.
Texture DX experiment
import AsyncDisplayKit
import BonMot
// MARK: - Action
extension TestNode {
public var didTapButton: () -> Void {
return buttonNode.on(.touchUpInside)
}
}
struct TestViewModel {
var title: String?
}
class TestNode: ASDisplayNode {
enum Style {
static let button: StringStyle = .init()
}
private let buttonNode: ASButtonNode = .init().setText("button", style: Style.button)
var viewModel: TestViewModel = .init(title: nil) {
didSet {
buttonNode.text = viewModel.title
}
}
}
let node = TestNode()
node.didTapButton {
self.router.pushViewController()
}
node.viewModel = TestViewModel(title: "hello world")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment