https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
c

curioustechizen

04/14/2020, 8:39 AM
Is there a way to figure out what contributes to the size of the generated iOS framework? I have a framework that's around 50MB (90MB if I generate a fat framework with iOSX64 and iOSArm64). I wonder if there's any unused stuff that's somehow getting imported into the framework. The generated header file is around 650KB so it is big (there are about 300 classes)
🤔 1
Okay I Just realized that the framework also contains all transitive dependencies of my shared kotlin code. That said, all these dependencies are described in the header file anyway, so the question remains: Is it normal for a framework to be so large?
k

Kris Wong

04/14/2020, 12:54 PM
one that contains all dependencies? yes
if it's static, it doesn't really matter how big it is. the static linker will only link symbols that are used in the consuming project
dynamic frameworks are another story
c

curioustechizen

04/14/2020, 1:03 PM
Okay thanks for the explanation. My concern with the framework size is not only about the app size - it is about distributing the framework through cocoapods.
We're pre-building the framework for distribution. Currently we're building a fat framework containing all target architectures. But that solves only one part of the problem: It does not take into consideration debug versus release
I was thinking we can fix this by simply publishing multiple pre-built frameworks (one each for release and debug). But that might make it prohibitively expensive, even using Git LFS, if the frameworks weigh in at 90s of MBs
k

Kris Wong

04/14/2020, 1:24 PM
if you are using cocoapods, why are you bundling dependencies into your framework?
c

curioustechizen

04/14/2020, 1:31 PM
Sorry I think I did not explain that clearly enough. We're using cocoapods for consuming our multiplatform framework from the iOS app. The multiplatform code itself does not have any cocoapods dependencies. Instead, it has kotlin library dependencies (that it fetches from maven - declared using standard gradle
implementation
block)
My guess is that the framework file contains all the kotlin dependencies (for example, we use
ktor
,
coroutines
and other such libs)
a

Amritansh

02/08/2021, 7:13 PM
@curioustechizen I am running into something similar as my framework size is quite large. Were you able to figure out why it was happening in your project?
c

curioustechizen

02/08/2021, 7:47 PM
@Amritansh unfortunately no. And I've moved on from that project so I have no idea what happened finally
👍 1