Your Swift app is full of symbols, even if stripped.

Your Swift app is full of symbols, even if stripped.

We have been drilled that we should strip debugging symbols before releasing our app on the App Store. Apple even does this automatically for us in the build settings when we create a new project.

However when we are using Swift as our programming language, a certain feature called Reflection, embeds in the app binary all the necessary names and types of every class/struct you have defined in your project so you can Mirror() the object and list all the attributes/types dynamically at runtime.

This trove of information is an incredible source of information to hackers. Apparently, this can be controlled by a Swift compiler flag SWIFT_REFLECTION_METADATA_LEVEL.

I stumbled on this in an Apple Developer Forum post:

Which lead me to this Apple Documentation page:

So if you are securing an iOS/macOS app, make sure to go into your Xcode project build settings, and find Swift Compiler General -> Reflection Metadata Level and set the value to None.