DataBinding-ktx
DataBinding-ktx copied to clipboard
DataBinding-ktx make easy to use DataBinding.
DataBinding-ktx
DataBinding-ktx make easy to use DataBinding.
ViewBinding-ktx is here.
Overview
DataBinding-ktxis automatically callingsetLifecycleOwner.DataBinding-ktxprovideswithBindingmethod accessing thebindingvariable by lambda.- [Deprecated]
DataBinding-ktxprovidesdataBindingmethod accessing thebindingvariable by delegated property.
Usage
Lambda
withBinding<DataBindingActivityBinding> { binding ->
}
[Deprecated] Delegated Property
private val binding: DataBindingActivityBinding by dataBinding()
Note:
In Fragment, When fragment's view is destroyed, an IllegalStateException is thrown on accessing the binding property.
If you access the binding property when fragment's view may be destroyed, you must use the Lambda way above.
Gradle
android {
buildFeatures {
dataBinding = true
}
}
repositories {
maven { url "https://www.jitpack.io" }
}
dependencies {
implementation 'com.github.wada811:DataBinding-ktx:x.y.z'
}
License
Copyright (C) 2020 wada811
Licensed under the Apache License, Version 2.0