Swiftpack.co - Package - rockbruno/swiftshield
SwiftShield logo
struct fjiovh4894bvic: XbuinvcxoDHFh3fjid {
  let VNfhnfn3219d: Vnahfi5n34djga
  func cxncjnx8fh83FDJSDd() -> Lghbna2gf0gmh3d {
    return vPAOSNdcbif372hFKF(VNfhnfn3219d.Gjanbfpgi3jfg())

SwiftShield: Swift Obfuscator

GitHub release

SwiftShield is a tool that generates random and irreversible encrypted names for your iOS project's types and methods (including third-party libraries). It uses Apple's SourceKit to mimick Xcode's indexing behavior, revealing a complete map of your project that is used to safely rename parts of your project.

Reverse engineering iOS apps is relatively simple due to the fact that almost every single type and method name is exposed in the app's binary. This allows jailbreak tools like class-dump and Cycript to extract this information and use it to change the behavior of your app in runtime.

Obfuscating code in iOS difficults the usage of these tools, while also makes it tougher for jailbreak developers to create tweaks for your app as SwiftShield's obfuscation changes every time you run it.


The capabilities of SwiftShield are directly related to the capabilities of SourceKit, which unfortunately has its share of bugs. However, although SwiftShield can't obfuscate everything, it can obfuscate just enough to make reverse engineering very hard. Check this document to see its capabilities in detail.


  • You should not have logic based on hardcoded names (like loading MyClass.json because String(describing: type(of:self)) is 'MyClass'). SwiftShield does not obfuscate things like file names and hardcoded strings -- only the types themselves.
  • No Objective-C classes that call Swift methods (but Swift classes calling Objective-C code is fine).
  • Your project should be 100% written in View Code. Older versions of SwiftShield did support obfuscating Storyboards/XIBs, but it was extremely hard to maintain. This parts from the principle that if you have a project big or important enough to be obfuscated, you probably shouldn't be using Storyboards in first place.
  • Your project should not be using Xcode's Legacy Build System setting.
  • Make sure your project doesn't suffer from one of SourceKit's bugs. Although the bugs won't prevent the project from being obfuscated, some of them might require you to manually fix the resulting code as it will not be able to compile.


Check this repo's example project to see it in action! You can run it by executing make swiftshield in your terminal.

Downloading SwiftShield

You can get a SwiftShield binary from the releases page.

Modify scripts that can affect SwiftShield

If your project uses a framework that also modifies your files like SwiftGen, you need to prevent them from running alongside SwiftShield. This can be done by checking for the $SWIFTSHIELDED Xcode variable that is added by SwiftShield after your project is obfuscated.

For example, my SwiftGen Xcode Run Script:

$PODS_ROOT/SwiftGen/bin/swiftgen images --output $SRCROOT/Asset.swift $SRCROOT/Assets.xcassets

...should be changed to:

if [ "$SWIFTSHIELDED" != "true" ]; then
    $PODS_ROOT/SwiftGen/bin/swiftgen images --output $SRCROOT/Asset.swift $SRCROOT/Assets.xcassets

Unlock Sources

If you're using a dependency manager like CocoaPods, you need to make sure that the sources are unlocked. If they aren't, SwiftShield will fail saying that it failed to overwrite the files. To unlock your project, execute:


Running SwiftInfo

USAGE: swiftshield obfuscate --project-file <project-file> --scheme <scheme> [--ignore-public] [--ignore-targets] [--verbose] [--dry-run] [--print-sourcekit]

  -p, --project-file <project-file>
                          The path to your app's main .xcodeproj/.xcworkspace
  -s, --scheme <scheme>   The main scheme from the project to build. 
  --ignore-public         Don't obfuscate content that is 'public' or 'open'
                          (a.k.a 'SDK Mode'). 
  -i, --ignore-targets    A list of targets, separated by a comma, that should
                          NOT be obfuscated. 
  -v, --verbose           Prints additional information. 
  -d, --dry-run           Does not actually overwrite the files. 
  --print-sourcekit       Prints SourceKit queries. Note that they are huge, so
                          use this only for bug reports and development! 
  -h, --help              Show help information.

Deobfuscating crash logs

A succesful run of SwiftShield generates a swiftshield-output/conversionMap.txt file that contains all changes made to your project:

//  SwiftShield
//  Conversion Map
//  Automatic mode for MyApp 2.0 153, 2018-09-24 10.23.48


ViewController ===> YytSIcFnBAqTAyR
AppDelegate ===> uJXJkhVbwdQGNhh
SuperImportantClassThatShouldBeHidden ===> GDqKGsHjJsWQzdq

Make sure to store this file when you publish a release, as it can be used to deobfuscate crash logs from the app that generated it through SwiftShield's deobfuscate subcommand.

USAGE: swiftshield deobfuscate --crash-file <crash-file> --conversion-map <conversion-map>

  -c, --crash-file <crash-file>
                          The path to the crash file. 
  -m, --conversion-map <conversion-map>
                          The path to the previously generated conversion map. 
  -h, --help              Show help information.
SwiftShield logo


Stars: 1277

Used By

Total: 0


4.1.0 - Property Obfuscation - 2020-05-23 20:44:08

Instance, class and global properties will now be obfuscated, with the exception of properties under types that inherit from Codable and classes exposed to Objective-C. For more information, check the limitations document.

Although we have lots of tests checking if property obfuscation is working correctly, we're still not certain that we covered all edge cases. If you don't feel like gambling on this, it might be better to use version 4.0.3.

4.0.3 - 2020-05-22 19:33:50

Fixed an issue where --ignore-public failed on references that contained multiple attributes (like public static)

4.0.2 - 2020-05-22 19:14:47

  • --ignore-public will now correctly avoid enums

4.0.1 - 2020-05-18 15:35:57

Files containing emojis will now be correctly obfuscated. This includes types that have emojis in their names and everything else. With this release, the relevant limitation was removed from SOURCEKITISSUES.md.

4.0.0 - Complete Refactor - 2020-05-14 10:26:40

SwiftShield has been completely remade. The first version was highly untested, and new features were very hard to develop and maintain. The code is now highly tested, including tests that run xcodebuild and SourceKit themselves. Now, we're able to know if SwiftShield works correctly with newer versions of Xcode, and new features are easy to test.

Functionality is mostly the same, but the usage details changed. Check the README for the newest set of instructions.

  • -sdk renamed to --ignore-public
  • Removed manual mode. Manual mode was created because the automatic mode was extremely unstable. Now that SourceKit works (mostly) correctly, the manual mode lost its purpose. If you were relying on it, let me know.
  • Removed Storyboard Obfuscation. This feature was untested, extremely hard to maintain and had tons of untreated edge cases. Since the usage of Storyboards is almost nonexistent in large projects (the target of SwiftShield), the feature was removed. SwiftShield will now only support view code obfuscation.
  • Revamped the example project.

3.5.1 - 2020-01-25 15:26:42

Fixed a problem with enum elements

3.5.0 - Activating Enums - 2020-01-13 12:30:47

  • Enums will be obfuscated, expect ones with the CodingKeys suffix - @hwdavr

3.4.1 - SDK Mode - 2020-01-08 15:30:03

  • Added -sdk mode by @hwdavr

3.4.0 - Xcode 11 support - 2019-10-21 12:50:12

  • Adds support to Xcode 11's file list format - @ldp940622

3.3.3 - 2019-04-27 21:06:44

  • Adding support for gestures/parameterless IBOutlets in Storyboards by @iOSleep

3.3.2 - 2019-04-13 21:21:51

  • Fixed SwiftShield failing when using with Xcode's new build system
  • SwiftShield will now correctly warn when xcodebuild fails

3.3.1 - 2018-11-25 16:52:31

  • Adds -dry-run
  • Revamped SourceKit Wrapper

3.3.0 - 2018-09-24 19:03:46

  • Adding -deobfuscate for crash logs
  • Adding support for Plist features such as NSExtensionPrincipalClass
  • Adding build info to map file
  • Optimizing manual obfuscation

3.2.1 - 2018-08-24 18:08:24

Fixed -ignore-modules not working in Storyboards/Xibs from non-ignored modules that used classes from ignored ones.

3.2.0 - 2018-08-23 22:20:29

  • Preparing code for property obfuscation
  • Fixed Storyboard outlet actions not being obfuscated (will only work for actions that are contained in the same module as the xib/storyboard, unless both modules are obfuscated)
  • Automatic mode will now fetch the correct storyboards from your compile arguments - ignoring storyboards that aren't being used or being ignored by modules

3.1.1 - 2018-08-22 20:55:44

  • Added -ignore-modules
  • Re-added -obfuscation-character-count

3.1.0 - 2018-08-21 21:33:04

Automatic Mode

  • Can now obfuscate method names
  • Fixed tons of edge cases and bugs
  • Disabled enum names/typealias/associatedtype obfuscation due to SourceKit edge cases


  • Fixed cases where the index failed because of spaces in folders
  • Large refactors
  • Name randomizer will now properly handle collisions

3.0.0 - 2018-06-29 21:16:27

  • Updating to Xcode 9.3 and Swift 4
  • Massive code refactor

2.0.2 - 2017-04-26 14:19:53

  • To prevent conflicts with pods, tags can now only be inserted at the end of a property/class name
  • Fixed a case where : was considered a valid symbol for a property name
  • Fixed manual mode not considering Objective-C files

2.0.1 - Performance and tag improvements - 2017-04-21 17:37:16

  • Manual mode performance improvements
  • You can now include symbols in your tags

Automatic mode revamp, and a new manual mode - 2017-04-20 21:13:58

  • Automatic mode now uses SourceKit, but it doesn't work for everyone one
  • To compensate for this, SwiftShield now has a manual mode that can obfuscate anything

1.0.1 - 2017-02-18 21:02:29

  • Added -structs option
  • Lots of bug fixes and improvements
  • Still slow

1.0.0 - 2017-02-12 18:57:14

  • Disabled struct/protocol obfuscation for now
  • Classes named after their own modules are now an exception
  • Projects get a "SWIFTSHIELDED" property injected into them
  • Tons of bug fixes

0.9.3 - 2017-02-10 16:56:53

0.2 - Storyboard Support - 2017-01-19 15:49:50

  • Projects with .storyboard and .xib files are now supported.

0.1 - Initial Release - 2017-01-19 12:50:27

Basic Class and Struct support