# rockbruno/swiftshield architecture

> Architecture diagram of the GitHub repository rockbruno/swiftshield, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rockbruno/swiftshield
- Repository: https://github.com/rockbruno/swiftshield

## Overview

SwiftShield is a command-line Swift obfuscator: it discovers Xcode targets and compiler arguments, uses SourceKit indexing to identify declarations and references, rewrites source names, and emits a conversion map. A separate command uses that map to restore names in crash logs. The graph follows the sampled CLI, controller, interactor, project-discovery, and obfuscator code; some internal relationships rely on the SOURCE INDEX or README rather than full source excerpts.

Main entry points: [`Sources/SwiftShieldCore/Controller/SwiftShieldAssembler.swift`](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Controller/SwiftShieldAssembler.swift) (Dependency assembly), [`Sources/SwiftShieldCore/Interactor/SwiftShieldInteractor.swift`](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Interactor/SwiftShieldInteractor.swift) (Workflow interactor), [`Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscator.swift`](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscator.swift) (SourceKit obfuscator), [`Sources/SwiftShieldCore/ProjectRunner/SchemeInfoProvider.swift`](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/ProjectRunner/SchemeInfoProvider.swift) (Scheme discovery)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and orchestration"]
  node_cli["CLI commands<br/>[main.swift]"]
  node_assembler["Dependency assembly"]
  node_controller["Run controller"]
  node_interactor["Workflow interactor"]
  node_logger["Logger<br/>[Logger.swift]"]
end

subgraph group_discovery["Project discovery"]
  node_scheme["Scheme discovery"]
  node_taskrunner["Task runner<br/>[TaskRunner.swift]"]
  node_modules["Target modules<br/>[Module.swift]"]
end

subgraph group_obfuscation["Source obfuscation"]
  node_obfuscator["SourceKit obfuscator"]
  node_indexdata["Index data store"]
  node_indexedfile["Indexed file<br/>[IndexedFile.swift]"]
  node_sourcekit["SourceKit wrapper<br/>[SourceKit.swift]"]
  node_conversion["Conversion map"]
end

subgraph group_recovery["Crash recovery"]
  node_deobfuscator["Crash deobfuscator<br/>[Deobfuscator.swift]"]
end

node_user(("Engineer"))
node_xcode["Xcode build"]
node_projectfiles["Project files"]
node_crashfile["Crash log"]

node_user -->|"runs"| node_cli
node_cli -->|"assembles"| node_assembler
node_cli -->|"invokes"| node_deobfuscator
node_assembler -->|"constructs"| node_controller
node_assembler -->|"constructs"| node_interactor
node_assembler -->|"constructs"| node_scheme
node_assembler -->|"constructs"| node_obfuscator
node_assembler -->|"constructs"| node_logger
node_controller -->|"runs workflow"| node_interactor
node_interactor -->|"discovers modules"| node_scheme
node_scheme -->|"runs build"| node_taskrunner
node_xcode -->|"provides build output"| node_scheme
node_scheme -->|"parses targets"| node_modules
node_interactor -->|"registers and obfuscates"| node_obfuscator
node_obfuscator -->|"queries index"| node_sourcekit
node_obfuscator -->|"stores index data"| node_indexdata
node_indexdata -->|"tracks files"| node_indexedfile
node_obfuscator -->|"produces map"| node_conversion
node_interactor -->|"formats map"| node_conversion
node_interactor -->|"prepares file contents"| node_controller
node_controller -->|"writes changes"| node_projectfiles
node_conversion -->|"writes map"| node_projectfiles
node_deobfuscator -->|"rewrites names"| node_crashfile
node_deobfuscator -->|"reads map"| node_conversion

click node_cli "https://github.com/rockbruno/swiftshield/blob/master/Sources/swiftshield/main.swift"
click node_assembler "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Controller/SwiftShieldAssembler.swift"
click node_controller "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Controller/SwiftShieldController.swift"
click node_interactor "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Interactor/SwiftShieldInteractor.swift"
click node_logger "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Log/Logger.swift"
click node_scheme "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/ProjectRunner/SchemeInfoProvider.swift"
click node_taskrunner "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/ProjectRunner/TaskRunner/TaskRunner.swift"
click node_modules "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/BaseModels/Module.swift"
click node_obfuscator "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscator.swift"
click node_indexdata "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscatorDataStore.swift"
click node_indexedfile "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Obfuscator/IndexedFile.swift"
click node_sourcekit "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/SourceKit/SourceKit.swift"
click node_conversion "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/ConversionMap.swift"
click node_deobfuscator "https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Deobfuscator/Deobfuscator.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_assembler,node_controller,node_interactor,node_logger toneBlue
class node_scheme,node_taskrunner,node_modules toneAmber
class node_obfuscator,node_indexdata,node_indexedfile,node_sourcekit,node_conversion toneMint
class node_deobfuscator toneRose
class node_user,node_xcode,node_projectfiles,node_crashfile toneIndigo
```

## Components

### CLI and orchestration

- [CLI commands](https://github.com/rockbruno/swiftshield/blob/master/Sources/swiftshield/main.swift): `Sources/swiftshield/main.swift`
- [Dependency assembly](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Controller/SwiftShieldAssembler.swift): `Sources/SwiftShieldCore/Controller/SwiftShieldAssembler.swift`
- [Run controller](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Controller/SwiftShieldController.swift): `Sources/SwiftShieldCore/Controller/SwiftShieldController.swift`
- [Workflow interactor](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Interactor/SwiftShieldInteractor.swift): `Sources/SwiftShieldCore/Interactor/SwiftShieldInteractor.swift`
- [Logger](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Log/Logger.swift): `Sources/SwiftShieldCore/Log/Logger.swift`

### Project discovery

- [Scheme discovery](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/ProjectRunner/SchemeInfoProvider.swift): `Sources/SwiftShieldCore/ProjectRunner/SchemeInfoProvider.swift`
- [Task runner](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/ProjectRunner/TaskRunner/TaskRunner.swift): `Sources/SwiftShieldCore/ProjectRunner/TaskRunner/TaskRunner.swift`
- [Target modules](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/BaseModels/Module.swift): `Sources/SwiftShieldCore/BaseModels/Module.swift`

### Source obfuscation

- [SourceKit obfuscator](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscator.swift): `Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscator.swift`
- [Index data store](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscatorDataStore.swift): `Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscatorDataStore.swift`
- [Indexed file](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Obfuscator/IndexedFile.swift): `Sources/SwiftShieldCore/Obfuscator/IndexedFile.swift`
- [SourceKit wrapper](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/SourceKit/SourceKit.swift): `Sources/SwiftShieldCore/SourceKit/SourceKit.swift`
- [Conversion map](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/ConversionMap.swift): `Sources/SwiftShieldCore/ConversionMap.swift`

### Crash recovery

- [Crash deobfuscator](https://github.com/rockbruno/swiftshield/blob/master/Sources/SwiftShieldCore/Deobfuscator/Deobfuscator.swift): `Sources/SwiftShieldCore/Deobfuscator/Deobfuscator.swift`

### Other components

- **Engineer**
- **Xcode build**
- **Project files**
- **Crash log**

## Connections

- Engineer → CLI commands: runs (evidence: `Sources/swiftshield/main.swift`)
- CLI commands → Dependency assembly: assembles (evidence: `Sources/swiftshield/main.swift`)
- CLI commands → Crash deobfuscator: invokes (evidence: `Sources/swiftshield/main.swift`)
- Dependency assembly → Run controller: constructs (evidence: `Sources/SwiftShieldCore/Controller/SwiftShieldAssembler.swift`)
- Dependency assembly → Workflow interactor: constructs (evidence: `Sources/SwiftShieldCore/Controller/SwiftShieldAssembler.swift`)
- Dependency assembly → Scheme discovery: constructs (evidence: `Sources/SwiftShieldCore/Controller/SwiftShieldAssembler.swift`)
- Dependency assembly → SourceKit obfuscator: constructs (evidence: `Sources/SwiftShieldCore/Controller/SwiftShieldAssembler.swift`)
- Dependency assembly → Logger: constructs (evidence: `Sources/SwiftShieldCore/Controller/SwiftShieldAssembler.swift`)
- Run controller → Workflow interactor: runs workflow (evidence: `Sources/SwiftShieldCore/Controller/SwiftShieldController.swift`)
- Workflow interactor → Scheme discovery: discovers modules (evidence: `Sources/SwiftShieldCore/Interactor/SwiftShieldInteractor.swift`)
- Scheme discovery → Task runner: runs build (evidence: `Sources/SwiftShieldCore/ProjectRunner/SchemeInfoProvider.swift`)
- Xcode build → Scheme discovery: provides build output (evidence: `Sources/SwiftShieldCore/ProjectRunner/SchemeInfoProvider.swift`)
- Scheme discovery → Target modules: parses targets (evidence: `Sources/SwiftShieldCore/ProjectRunner/SchemeInfoProvider.swift`)
- Workflow interactor → SourceKit obfuscator: registers and obfuscates (evidence: `Sources/SwiftShieldCore/Interactor/SwiftShieldInteractor.swift`)
- SourceKit obfuscator → SourceKit wrapper: queries index (evidence: `Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscator.swift`)
- SourceKit obfuscator → Index data store: stores index data (evidence: `Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscator.swift`)
- Index data store → Indexed file: tracks files (evidence: `Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscatorDataStore.swift`)
- SourceKit obfuscator → Conversion map: produces map (evidence: `Sources/SwiftShieldCore/Obfuscator/SourceKitObfuscator.swift`)
- Workflow interactor → Conversion map: formats map (evidence: `Sources/SwiftShieldCore/Interactor/SwiftShieldInteractor.swift`)
- Workflow interactor → Run controller: prepares file contents (evidence: `Sources/SwiftShieldCore/Interactor/SwiftShieldInteractor.swift`)
- Run controller → Project files: writes changes (evidence: `Sources/SwiftShieldCore/Controller/SwiftShieldController.swift`)
- Conversion map → Project files: writes map
- Crash deobfuscator → Crash log: rewrites names (evidence: `Sources/SwiftShieldCore/Deobfuscator/Deobfuscator.swift`)
- Crash deobfuscator → Conversion map: reads map (evidence: `Sources/SwiftShieldCore/Deobfuscator/Deobfuscator.swift`)
