Austin Paquette
07/14/2021, 7:38 PMbody
parameter, but in my own abstraction of a client for a particular service endpoint.
Basically, I have this function (fluff removed), but point is clear.
sendNotification(listOf("..."), listOf("..."))
This is ultimately fine and works as intended, but I am trying to find a way to explicitly set each of these values. Instead I'd like to do this:
sendNotification() {
subscriberKeys = listOf("...")
users = listOf("...")
}
This helps me describe exactly what I need each value to be and then pass them through the implementation, I just don't fundamentally understand the examples provided.
I've tried with some smaller sample code but nothing quite clicks yet. I'll gladly accept links to helpful resources too, I've done a fair amount of searching but nothing has quite illuminated the lightbulb on this.Shawn
07/14/2021, 7:40 PMsendNotification(
subscriberKeys = listOf(...),
users = listOf(...),
)
Shawn
07/14/2021, 7:42 PMAustin Paquette
07/14/2021, 7:49 PMShawn
07/14/2021, 8:06 PMnkiesel
07/14/2021, 10:12 PMfun foo(body: () -> Unit)
, you can call this with foo { ... }
instead of foo({ ... })
by applying 2 rules: (1): if the last argument of a function is a lambda, you can move that out of the ()
when calling the function and (2) if you call a function using "trailing lambda" and that function needs no other parameters than the lambda, you can omit the ()