Matthew Murray
06/21/2022, 6:54 PMswitch
statement with Kotlin/Native enums in Objective-C. I’m getting the error Statement requires expression of integer type ('NtvCoreRateType *' invalid)
. It seems that Kotlin enum classes don’t get converted into proper enums in objective-C, so I’m wondering if its at all possible to do a switch statement with them? And if not, what is the expected way to compare them?Nikolay Kasyanov
06/22/2022, 9:01 AMdefault:
clause), but in Obj-C, as far as my understanding goes, you’d have to resort to if-else if….
There’s a ticket to expose “raw” enum values to Obj-C/Swift though: https://youtrack.jetbrains.com/issue/KT-48068/Native-Feature-Request-Add-typed-ordinal-for-enums-bridged-to-Obj-C
Hopefully it will get some love one day.Matthew Murray
06/22/2022, 7:25 PMNikolay Kasyanov
06/22/2022, 7:28 PMMatthew Murray
06/22/2022, 7:33 PMcase
statements though, since it wants the values to be constants, and it doesn’t see recognize the values from KotlinEnum as constants