https://kotlinlang.org logo
#android
Title
# android
w

withoutclass

04/17/2018, 7:00 PM
looks like a possible known issue with kotlin's
Unit
, or rather Data Bindings ability to deal with it.
b

bachhuberdesign

04/17/2018, 8:30 PM
Yeah I’m starting to get the impression that it’s not possible (currently). Thanks for the link, maybe i should file an issue
Afaik, the workaround for this is just to pass a function that returns anything other than Unit (so
function: (View) -> Any
), not quite as clean but not a bad workaround
w

withoutclass

04/17/2018, 8:55 PM
I'll be curious to see if that works for you. I haven't done too much in data binding myself.
b

bachhuberdesign

04/17/2018, 9:04 PM
Yep, it’s working for me after changing the return to
Any
. I can still use
Unit
, which makes it even weirder
Example:
Copy code
fun testFunction() = Unit
throws StackOverflowException, but
Copy code
fun testFunction(): Any = Unit
works fine
As far as I can tell. Still need to test more
3 Views