Orhan Tozan
07/07/2020, 10:43 AMfun interface CreateTodoUseCase { fun run() }
over interface CreateTodoUseCase { operator fun invoke() }
? I see the latter being used alot for writing UseCases (myself included. Should I switch to functional interfaces instead?Michael de Kaste
07/07/2020, 11:00 AMOrhan Tozan
07/07/2020, 11:07 AMOrhan Tozan
07/07/2020, 11:07 AMMichael de Kaste
07/07/2020, 11:11 AMJavier
07/07/2020, 11:27 AMarekolek
07/07/2020, 11:28 AMfun interface
as a replacement for operator fun invoke()
🤔 I'm wondering what would be an example of that
I see fun interface
being useful in case some function accepts the interface as argument and you want to make possible to use lambda syntax when calling it:
fun foo(bar: Bar) {
bar.baz()
}
fun interface Bar {
fun baz()
}
fun main() {
foo {
println("Spam")
}
}
Matteo Mirk
07/07/2020, 1:07 PMJavier
07/07/2020, 1:09 PM