When object are created from Swift, there is no way to get the kotlin sealed object.
It would be great if the plugin generate the reverse operation toObject() :
public enum ActionKs {
case test
case test2(Action.Test2)
public init(_ obj: Action) {
if let obj = obj as? common.Action.Test2 {
self = .test2(obj)
} else if obj is common.Action.Test {
self = .test
} else {
fatalError("ActionKs not syncronized with Action class")
}
}
public func toObject() -> Action {
switch self {
case .test2(let obj):
return obj
case .test:
return common.Action.Test()
}
}
}
When object are created from Swift, there is no way to get the kotlin sealed object.
It would be great if the plugin generate the reverse operation toObject() :