square/Blueprint

[Question] How blueprint manages data change and trigger view update

shuoli84 opened this issue · 2 comments

The doc mentioned auto ui update for data change, but didn't see this in tutorial.

Blueprint supports updating the hierarchy at any time – but it is up to the consuming app to tell it to update (there is no automatic data binding or anything).

Your code might look something like this:

final class MyViewController: UIViewController {

    /// etc... 

    private let blueprintView: BlueprintView

    // Hypothetical delegate method
    func dataDidChange(data: NewData) {
       blueprintView.element = MyRootElement(data: data)
    }

}

Got it. Thanks.