Can anyone enlightens me about below shortcut stru...
# android
p
Can anyone enlightens me about below shortcut structure in Kotlin: fun letsSearch(search: SearchModel.() -> SearchModel) { //how to utilize search param here.. }
j
Perhaps the information about type safe builders can enlighten you https://kotlinlang.org/docs/type-safe-builders.html#how-it-works
👍 1
m
SearchModel is passed into the lambda as ‘this’ and lambda expects it will return a SearchModel instance, so this basically looks like a function to update SearchModel, probably via copy
❤️ 1
Link from Jan explains it on an example
👍 1