I'm trying to understand what is happening inside of the LazyColumn
with the interface LazyListScope
and its extension function items(List<T>,...)
.
The concept was new to me and I was playing around a little bit with the program.
Now, I wonder - why is this code not printing the message from the extension function?
If I'm right the method printInterface()
is implementing MyInterface
via an anonymous object. The extension function of the interface should work now, or not?
But if I run the program I don't see the message "Hello"
from the extension function.
fun main(args: Array<String>){
printInterface {
printExtension()
}
}
fun printInterface(content: MyInterface.() -> Unit) {}
interface MyInterface {}
fun MyInterface.printExtension() {
println("Hello")
}