androidbroadcast / ViewBindingPropertyDelegate

Make work with Android View Binding simpler
https://proandroiddev.com/make-android-view-binding-great-with-kotlin-b71dd9c87719
Apache License 2.0
1.42k stars 102 forks source link

Need explanation behind the solution. #34

Closed RohitSurwase closed 3 years ago

RohitSurwase commented 3 years ago

There are two popular articles on View Binding Delegates, 1st is https://medium.com/@Zhuinden/simple-one-liner-viewbinding-in-fragments-and-activities-with-kotlin-961430c6c07c and 2nd is yours. I have seen both implementation, there are some differences in the implementation. Being a developer of one such solution, you would be able to understand the difference better. So, how does you implementation differ from this https://gist.github.com/Zhuinden/ea3189198938bd16c03db628e084a4fa implementation? Also, I have have seen some comments which warn against using such implementation. So what are those things that anyone should keep in mind while using such implementation? I hope you would shed some light on this. I have asked similar question on the other solution too! As, we can grow better as a community. Thanks!

kirich1409 commented 3 years ago

Hi. Difference between solutions is work with Fragment's lifecycles. My library is lazy and will create ViewBinding on first access to it and have ability working in Fragment.onDestroyView(). @Zhuinden solution is good and have the same idea of create and clear ViewBinding.