Is there any way for K/N to generate framework for...
# kotlin-native
z
Is there any way for K/N to generate framework for OC only? Many times we don’t need to use both OC and Swift, and generating framework for both languages will increase package size significantly i thought.
s
The framework will always work with both objc and Swift because swift uses it's objc interop layer to access any non-swift framework. There isn't anything extra in the binary for swift support. There are extra directives in the module header to specify swift names but that won't affect shipping binary size.
👍 2
z
Well, I'm new to kotlin native and I'm trying to read it from code. I think the incremental of package size on iOS is unacceptable(about 2.4MB), So is there anyway to trim the size of framework binary generated by kn?
s
One thing that helps is to limit what classes in your library are public. Each public class is accompanied by generated ObjC bridging code. Classes that aren’t public don’t have this extra bridging code. Your framework will still contain a copy of the Kotlin runtime. There’s just no way around that unless Apple buys Jetbrains and decides to bundle the Kotlin runtime with iOS like they do with Swift. Let’s hope that JB would say no…
blob big smile 3