At my job, we have a set of dynamic frameworks that we are building which are mostly (if not entirely) Swift. Recently, we have been looking into the binary size of these frameworks, and I've been doing a little testing to figure out ways to reduce the binary size.
The first thing I've tested is enabling all stripping for the building of the binaries, which reduced the size of the binaries by about 25-30%. I'm not surprised that the binary size decreased, but I am surprised at just how much of a difference it made. Stripping only at the final app compilation made no difference, but since these are dynamic frameworks, I think that's expected.
The second thing I tested is a bit more surprising. I removed all public modifiers I could while still allowing the build to complete (with the understanding that a lot would break). This also resulted in a decrease of 25-30%, and adding stripping on top of this reduced the binary size even further.
I'm not entirely sure what the specific reason for removing public functions/vars resulting in smaller binary size is.
Has anyone else seen this behavior? Is there some documentation or other information I can use to help craft a better plan to move forward on this?