Android-CleanArchitecture-Kotlin
Android-CleanArchitecture-Kotlin copied to clipboard
info query about binding format in the view
For me this project is interesting because it is based on viewmodel pattern I see it uses livedata, observe: very cool! But I would have expected to see the binding like
android:layout_height="wrap_content"
android:text="@{user.firstName, default=my_default}"/>
(from https://developer.android.com/topic/libraries/data-binding/expressions) where are they in such project? Thanks in advance for your hint!
Do you think it makes sense to introduce (from this other [post] ) a gradle dependency for databinding?(http://www.albertgao.xyz/2018/04/13/minimal-android-mvvm-databinding-setup-with-kotlin/))
apply plugin: 'kotlin-kapt'
android {
dataBinding {
enabled = true
}
}
dependencies {
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
kapt "com.android.databinding:compiler:3.1.1"
}
so that one can simply write android:text="@{viewModel.name}"?
Or see the paragraph Layout, DataBinding and BindingAdapters of a longer article about MVVM kith Kotlin.
I come from the world of MVVM in dotnet (C# and F# with WPF) so I'd appreciate very much the {...} curly parentheses format for data binding :-)