I wrote a Kotlin based library to help reduce the Boilerplate code for ViewBinding in Android to bare necessity, making it easy to use and wrote my first article explaining the same. Give it a read, if the topic interests you. Any feedback is welcome and appreciated. Thanks.
Here is the link to the library.
02/25/2021, 5:16 PM
Hi. Does it handles problem of view binding memory leaks?
02/25/2021, 5:26 PM
Yes @Nikolay Puliaev. The binding object is cleared after a view life cycle is destroyed. So I guess it does.
02/25/2021, 6:13 PM
But why create a baseclass for something that could be done via a delegate?
02/26/2021, 4:09 AM
I completely understand that. You make a valid point. It is just that where I work we have a lot of abstract implementations for various scenarios with various base methods. For example, we a MediaFragment which can be used if we need to pick an image or video and compress it and return its file. So that is where my mind went. Thanks for the feedback though.
02/26/2021, 8:23 AM
Then I suggest you and your people at work should look into „composition over inheritance“. It will make your codebase much cleaner
02/26/2021, 8:25 AM
Yes, I will definitely take a look @flosch. From my POV the whole codebase needs revamp, but due to limited time we are working with what we have for now.