fun mySort(uiState: UiState): Int = // sort based on some criteria
val uiStates: List<UiState>
uiStates.sortedBy(mySort) // doesn't compile: Function invocation `mySort(...)` expected; No value passed for parameter `uiState`
Lukasz Kalnik
11/09/2023, 12:26 PM
OK, forgot that function references need to be prefixed with a double colon 🤦
This works:
Copy code
uiStates.sortedBy(::mySort)
😄 2
rubber duck 5
t
Travis Griggs
11/10/2023, 12:51 AM
ok... why a rubber duck emoji? I'm missing a cult reference here. or at least how it applies (I'm running through the James Veitch duck sketch and trying to figure out how that apply here)