Dev builds Gradle plugin to cut KMP iOS export bloat, trims 5.7 MB in minutes
A developer optimizing a personal Kotlin Multiplatform app discovered that 61% of its 459 Objective-C exports had no Swift call sites, generating thousands of lines of unnecessary bridging code. To investigate, he built a Gradle plugin called kmprofiler that parses the generated Objective-C header and flags declarations never referenced in Swift source files. The bloat stemmed mainly from public theme constants, internal UI state models, and third-party library types leaking into the header via exposed function signatures. By marking just five files as internal in the shared Kotlin module, he reduced the Shared.h header from 23,622 to 13,327 lines and cut the compiled framework object size by 5.7 MB. The plugin, kmprofiler v0.1.0, has been published to the Gradle Plugin Portal for other KMP developers to use.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in