Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding according to the generated associated classes #5

Closed
ztc1997 opened this issue Mar 31, 2016 · 1 comment
Closed

Binding according to the generated associated classes #5

ztc1997 opened this issue Mar 31, 2016 · 1 comment

Comments

@ztc1997
Copy link

ztc1997 commented Mar 31, 2016

Currently, this library is binding according to the simple name of binded member, what is a string programmer may typo. I highly recommend you refer to DBFlow's approach, generates the associated classes for each model, contains special properties for binded members, and binding according to the special properties.
E.g.
The model:

class SimpleModel : ViewModel() {
    @delegate:Property
    var name by Delegates.property<String>()
}

The associated class:

class SimpleModel_KB {
    val name: BindingProperty<String> = ...
}

Using in UI:

textView {
    bind { text(SimpleModel_KB.name) }
}
@EndSmile
Copy link
Contributor

@ztc1997
Now generate the corresponding name constants in the file ~$$KB that is automatically generated for the annotation.
You can use the

`LoginViewModel$$KB`.k_login"

form,also can directly use the "k_login" after the import

`LoginViewModel$$KB`.*

Please see LoginFragment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants