I’m not sure if this is the proper place to ask, but what do you think about allowing following syntactic sugar:
infix fun View.onClick( func : () -> Unit){
this.setOnClickListener{ func() }
}
class Foo{
val bar : Bar = ...
val viewA : View = ...
val viewB : View = ...
fun fooFun(){}
fun setListeners(){
viewA onClick ::fooFun
viewB onClick bar::barFun
}
}
Above code currenty works without any major issues. Is there possibility to create a similar extension, but with possibility of passing arguments?
fun doSomething(foo : Int, bar : Int){ ... }
view onClick ::doSomething(foo,bar)
Just a fun question, not a requirement or language feature request