Skip to content

Commit

Permalink
Fix #54
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanCaiCoding committed May 10, 2022
1 parent 1ab9278 commit 93daa68
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ inline fun <reified VB : ViewBinding> Fragment.binding(method: Method) =
class FragmentBindingProperty<VB : ViewBinding>(private val clazz: Class<VB>) : ReadOnlyProperty<Fragment, VB> {

override fun getValue(thisRef: Fragment, property: KProperty<*>): VB =
requireNotNull(thisRef.view) { "The property of ${property.name} has been destroyed." }
requireNotNull(thisRef.view) { "The constructor missing layout id or the property of ${property.name} has been destroyed." }
.getBinding(clazz).also { binding ->
if (binding is ViewDataBinding) binding.lifecycleOwner = thisRef.viewLifecycleOwner
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fun <VB : ViewBinding> Fragment.binding(inflate: (LayoutInflater) -> VB) = Fragm

class FragmentBindingDelegate<VB : ViewBinding>(private val bind: (View) -> VB) : ReadOnlyProperty<Fragment, VB> {
override fun getValue(thisRef: Fragment, property: KProperty<*>): VB =
requireNotNull(thisRef.view) { "The property of ${property.name} has been destroyed." }
requireNotNull(thisRef.view) { "The constructor missing layout id or the property of ${property.name} has been destroyed." }
.getBinding(bind).also { binding ->
if (binding is ViewDataBinding) binding.lifecycleOwner = thisRef.viewLifecycleOwner
}
Expand Down

0 comments on commit 93daa68

Please sign in to comment.