Created
June 19, 2020 03:53
-
-
Save GeekTree0101/1e18026bdb01790e7811e4769b7a5acd to your computer and use it in GitHub Desktop.
Texture DX experiment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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