Replies: 1 comment 1 reply
-
Thank you for the report. It's a little inaccurate. We should be able to fix this, but it'd be a source-breaking change for the rest of the codebase, because it'd map all |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is the problem?
Primitive Kotlin types are represented in the Objective-C header as regular Objective-C primitives. Swift's Objective-C interop bridges them directly to native Swift primitives. That results in a nice translation of Kotlin's
Int
to Swift'sInt32
, Kotlin'sBoolean
to Swift'sBool
etc.Those Objective-C primitives, however, don't support nullability, nor can they be used as a type argument. Therefore, when a primitive type is nullable, or used as a generic type argument, Kotlin uses a special box type. Each primitive has one defined
KotlinInt
forInt
,KotlinBoolean
forBoolean
etc. And these don't bridge to native Swift types and have to be explicitly unboxed.What is the proposed solution?
Due to SKIE's support for extending Objective-C bridging, it should be possible to declare bridges for these primitive box types to map directly to Swift's primitive types.
Beta Was this translation helpful? Give feedback.
All reactions