What does "strip Swift symbols" in Xcode actually do?
Asked Answered
B

1

26

When exporting an archive of a project containing Swift, we get the option to "strip Swift symbols". I haven't seen any difference in app size though in a project with just one dummy Swift file, thus a perfect case for maximum stripping.

What does this do exactly and how does it affect the final app size (.ipa)?

enter image description here

P.S: as seen in Xcode 9 beta 6

UPDATE: actually I can observe a slight ipa size reduction (3.4 MB uncompressed) when looking at specific devices variants (not for universal variant though)

Burnette answered 6/9, 2017 at 14:21 Comment(1)
The only thing I can think of in this context is reverse engineering. But to make you sure, you still will be able to see readable crashes. I can confirm that builds still include debug symbols (dSYM) with Strip Swift symbols flag enabled.Ance
I
17

According to the Xcode docs:

The new Strip Swift Symbols (STRIP_SWIFT_SYMBOLS) build setting is enabled by default. It adjusts the level of symbol stripping so that when the linked product of the build is stripped, all Swift symbols are removed. This significantly reduces the size of Swift frameworks. If the lack of Swift symbols causes problems, such as when using dladdr(), this setting can be disabled. To view the exported symbols from file that has been stripped, use xcrun dyldinfo -export instead of nm. (31306055)

Instead answered 18/11, 2017 at 16:26 Comment(3)
nm -g -U on a binary produces a similar result to xcrun dyldinfo -exportNim
This flag is silently removed: No longer available in Xcode 13.4, no update in the release notesLimitless
as of Xcode 14 xcrun dyld_info -exportsCorpuz

© 2022 - 2024 — McMap. All rights reserved.