freshOS / Komponents-deprecated

📦 React-inspired UIKit Components - ⚠️ Deprecated
MIT License
208 stars 12 forks source link

can I rebind the ref property? #3

Open hpsoar opened 7 years ago

hpsoar commented 7 years ago

What if I rebind another UITextField to a Field node or another UIButton to a Button node?

Ideally, I'd like to have a layout pre-build based on model, then I may bind this layout and model to different views.

This is the usual case we deal with UITableView/UITableViewCell.

The use case may be like this:

class MyLayout: <Your Layout Base Class> {
    public var button: Button!
    public var field: Feild!

    func calculateLayout(model: <SomeModel>) {
    }
}

...

    let layout = MyLayout()   // this layout may be hold after calculation
    ...
    layout.button.bind(<some UIButton>) or layout.button.ref = <some UIButton>
    layout.feild.bind(<some UITextField>) or layout.field.ref = <some UITextField>
    ...
s4cha commented 4 years ago

⚠️ Swift UI is out so this is now deprecated in favor of the official alternative. This will no longer be maintained. This was a fun experiment 😎. No updates will be issued unfortunately