I'm just testing out using Kotlin Native to create a cross-platform library, and so far it looks fantastic! One wrinkle, though: when I make an Objective C framework (for use on iOS) it exports MyClass just fine, but also outputs MyClassCompanionObject, with static functions attached.
I understand why that's happening, and in many ways it's the more correct interpretation of the Kotlin code, but it doesn't match any pattern used in Objective C or Swift. Is there any way to combine these two classes to provide static functions on the original class?
What criteria would you suggest for putting methods out of companion to statics of the Objective-C class?
I would suggest an opt-in mechanism, probably something like @JvmStatic but for Objective-C. object (free or companion) members annotated with e.g. @ObjCStatic would cause the compiler to emit a static bridge (on the enclosing class in the case of companion objects, otherwise on the actual object type).
According migration to YouTrack, closing this issue in favour of https://youtrack.jetbrains.com/issue/KT-44862. Please continue any discussions there.
Most helpful comment
I would suggest an opt-in mechanism, probably something like
@JvmStaticbut for Objective-C.object(free orcompanion) members annotated with e.g.@ObjCStaticwould cause the compiler to emit a static bridge (on the enclosing class in the case ofcompanionobjects, otherwise on the actualobjecttype).