Daniele B
03/12/2021, 8:25 PMfun MyModel.anExtensionFunction() {
objectLambda {
it.getText()
}
}
where it is the obj property of the MyModel class
How should I write the objectLambda function in order to do so?
class MyModel {
var obj = MyObject()
fun objectLambda() {
// HOW SHOULD I WRITE THIS FUNCTION?
}
}
class MyObject {
fun getText() = "myText"
}
ephemient
03/12/2021, 8:45 PMfun objectLambda(block: (MyObject) -> Unit) {
block(obj)
}
Daniele B
03/12/2021, 10:00 PMDaniele B
03/12/2021, 10:19 PM