Is there a way to get the keypaths to a class’s co...
# getting-started
h
Is there a way to get the keypaths to a class’s companion object such as this:
Copy code
class Test {    
    companion object {
        const val A: Int = 0

        const val B: Int = 1

        const val C: Int = 2

        const val DInt = 3

        const val E: Int = 4
    }
}
This companion object will only have constant vals
d
What are "keypaths"?
p
Why do you even need to do that
that is a swift concept @diesieben07
d
The Kotlin equivalent would be properties, I guess.
Copy code
val x: KProperty0<Int> = Test.Companion::A
x.get()
Or do you actually want to use this from Swift?
c
Seems like you could use a data class? Its not 100% clear what the goal is here
h
Ah yeah they’re KProperties here. This is generated code. I just wanted to know if there was a way to get all the companion object’s properties in a simple way. Of course the better way would be an enum class but right now it will be a companion object