I've heard conflicting views on this, but should I...
# android
k
I've heard conflicting views on this, but should I be avoiding the Kotlin synthetics for binding views?
j
Well that's because it's opinion based. And by asking the question again, you'll get the same set of differing opinions.
I vote no, if it matters.
r
I second that. For every piece of technology/framework/library/language/architecture , There is always at least 10 devs that hate it😂
p
As far as I know, kotlin's synthetic view binding is hated due to no view caching in some cases. Despite of it, I like synthetics, always simpler than delegates / annotations or whatever. In my opinion workaround for mentioned cases may be something like this: val btn : Button = xx_yy_button Although not tested by myself yet.
j
It also lacks safety that the references are actually from the layout you're using and are present in every configuration of that layout.
🤔 2
r
@pg are you sure about that? I believe there is caching... look at section on view caching
k
@jw when you say you vote no, do you mean I shouldn't avoid them or I should avoid them? I'm assuming no
j
Avoid
k
gotcha, thanks