moko-kswift
moko-kswift copied to clipboard
Generate Swift enum class for Kotlin enum class
to support exhaustive whens/switches for Kotlin enums (either via a generated extension with blocks for every case, or maybe something like this)
I've made a generator to avoid default on enum. You can check it here. It produce extension like below
public extension shared.SpaceState.Status {
var `enum`: SpaceState.Status.Enum {
if self == shared.SpaceState.Status.idle {
return .idle
} else if self == shared.SpaceState.Status.pending {
return .pending
} else {
fatalError("SpaceState.Status not synchronized")
}
}
enum Enum {
case idle
case pending
}
}
Is it what you had in mind ? Do you want a PR ?
yes, it is. please create PR 👍
@cl3m please submit a PR 👍