Alen Kirm
02/24/2022, 8:28 PMenum class SomeEnum(val id: String) { VALUE1("value1"), VALUE2("value2") }
which you can instantiate in your Kotlin code via valueOf
method.
How can I instantiate it in Swift code? Swift doesnāt see valueOf
method. Iāve tried to add a compation object into an enum, to āfakeā valueOf
method but its not visible on Swift side either.
I guess workaround is to pattern match on Swift side, and just return an instance of SomeEnum
case:
switch valueInstance {
case "value1": return .value1
case "value2": return .value2
}
Are there any other solutions ? šPaul Woitaschek
02/25/2022, 6:12 AM