The Elite, Zero-Dependency iOS Debugging & Diagnostic Toolkit
PhantomSwift is an open-source iOS debugging library for Swift developers. It provides network inspection, memory leak detection, UI hierarchy exploration, and 25+ diagnostic tools β all in a single zero-dependency package. Compatible with UIKit and SwiftUI, installable via SPM or CocoaPods, with a minimum runtime target of iOS 12 and a validated Swift 5.9+ toolchain.
PhantomSwift is a professional-grade, modular debugging ecosystem for iOS apps. It ships 25 rich modules β from network inspection and performance profiling to remote WebSocket debugging and macro recording β all wrapped in a premium glassmorphic UI. Every line of code is compiled only in DEBUG builds, so it adds zero overhead to your production binary.
| PhantomSwift | FLEX | Pulse | Netfox | |
|---|---|---|---|---|
| Zero dependencies | β | β | β | β |
#if DEBUG safe |
β | β | β | β |
| Network inspection | β | β | β | β |
| 3D view hierarchy | β | β | β | β |
| Performance monitoring | β | β | β | β |
| Request interception | β | β | β | β |
| Bad network simulation | β | β | β | β |
| Feature flags | β | β | β | β |
| Remote WebSocket server | β | β | β | β |
| Memory leak tracker | β | β | β | β |
| Macro recorder | β | β | β | β |
| Security audit | β | β | β | β |
| Bug reporter | β | β | β | β |
| Glassmorphic UI | β | β | β | β |
| Module count | 25 | ~8 | ~5 | 1 |
- FLEX alternative β PhantomSwift covers everything FLEX does, plus network mocking, bad network simulation, feature flags, and a glassmorphic UI.
- Netfox replacement β PhantomSwift includes all Netfox's network inspection with 25 additional modules, and is also
#if DEBUGsafe. - Pulse iOS alternative β PhantomSwift adds zero-dependency constraint with full UIKit + SwiftUI support and no external packages required.
- Zero external dependencies β built entirely with Apple frameworks
#if DEBUGsafe β every file is wrapped; nothing ships to the App Store- iOS 12+ runtime support β with
#availableguards for newer APIs - Swift 5.x aligned β validated with Swift 5.9+ toolchains
- Glassmorphic UI β premium dark theme with blur, shadows, and micro-animations
- Modular architecture β enable or disable any module independently
- Screenshots
- Features
- Installation
- Quick Start
- Modules in Detail
- Architecture
- Configuration
- Requirements
- Contributing
- License
| Module | Description |
|---|---|
| Network Trace | Real-time HTTP/HTTPS traffic monitoring with full request/response inspection, HAR export, and search/filter |
| Interceptor | Mock, block, delay, or redirect any request. Mockoon redirect support. Hit counters and exclude patterns |
| Bad Network | Simulate poor connectivity (3G, Edge, packet loss, latency) with one tap |
| Network Waterfall | Chrome DevTools-style waterfall timeline showing request durations and concurrency |
| Request Replay | Edit and replay any captured request. Save responses as mock rules |
| HAR Export | Export network traces as HAR 1.2 JSON files for sharing with backend teams |
| Module | Description |
|---|---|
| Performance Monitor | Real-time CPU, FPS, and RAM tracking with interactive timeline graphs |
| Hang Detector | Main-thread freeze detection (>400ms) with full call stack capture |
| Main Thread Checker | Detects UIKit calls from background threads via method swizzling |
| Memory Leak Tracker | Automatic retain cycle detection with object lifecycle tracking |
| Memory Graph & Diff | Visual object relationship explorer and heap snapshot comparator |
| Module | Description |
|---|---|
| UI Inspector | Live property inspection with constraint details, measurement tool |
| 3D View Hierarchy | Xcode-style exploded 3D view with tap-to-select, depth slider, wireframe toggle, and pinch-to-zoom |
| SwiftUI Render Tracker | Track re-render frequency per SwiftUI component |
| Asset Inspector | Audit image/video assets for memory optimization and sizing |
| Accessibility Audit | Scan for missing labels, small touch targets, and A11y violations |
| Layout Conflict | Detect and display Auto Layout constraint conflicts in real-time |
| Module | Description |
|---|---|
| Storage Inspector | Browse and edit UserDefaults, Keychain, sandbox files, and SQLite databases |
| State Snapshot | Save entire app state (defaults, files) and restore it instantly |
| Module | Description |
|---|---|
| Console Logger | Priority-level logging with tags, metadata, and full-text search |
| Analytics Interceptor | Intercept and inspect analytics events (Firebase, Amplitude, custom) |
| Feature Flags | Register, toggle, and persist feature flags with grouped UI |
| Bug Reporter | Annotate screenshots with freehand drawing, export diagnostic bundles |
| Macro Recorder | Record touch sequences and replay them for QA regression testing |
| Remote Server | WebSocket debug server for real-time remote inspection |
| Security Audit | Jailbreak detection, SSL pinning check, and binary integrity verification |
| Environment Swapper | Spoof GPS, change locale, monitor battery/thermal state |
| Runtime Browser | Browse Objective-C classes, methods, and properties at runtime |
| Push Notification Tester | Simulate and test push notifications locally |
| Deeplink Tester | Test URL schemes and universal links without leaving the app |
Add PhantomSwift via Xcode:
- File β Add Package Dependencies...
- Enter the repository URL:
https://github.com/synaptode/PhantomSwift.git - Select version rule: Up to Next Major
- Add to your Debug target only
Or add it to your Package.swift:
dependencies: [
.package(url: "https://github.com/synaptode/PhantomSwift.git", from: "1.1.1")
]pod 'PhantomSwift', :configurations => ['Debug']Important: Always add PhantomSwift to your Debug configuration only. All code is wrapped in
#if DEBUG, but restricting the dependency ensures zero bytes in release builds.Compatibility: PhantomSwift supports iOS 12.0+ at runtime. The current package manifest and CocoaPods spec are validated with Swift 5.9+ toolchains, which keeps the library within the Swift 5 generation while matching the repo's actual build settings.
import SwiftUI
#if DEBUG
import PhantomSwift
#endif
@main
struct MyApp: App {
init() {
#if DEBUG
PhantomSwift.configure { config in
config.environment = .dev
config.triggers = [.shake, .dynamicIsland]
config.theme = .dark
}
PhantomSwift.launch()
#endif
}
var body: some Scene {
WindowGroup { ContentView() }
}
}import UIKit
#if DEBUG
import PhantomSwift
#endif
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
#if DEBUG
PhantomSwift.configure { config in
config.environment = .dev
config.triggers = [.shake]
config.theme = .dark
config.shortcuts = [
AppShortcut(title: "Clear Cache") {
URLCache.shared.removeAllCachedResponses()
}
]
}
PhantomSwift.launch()
#endif
return true
}
}| Trigger | How |
|---|---|
| Shake | Shake your device (default trigger) |
| Dynamic Island | Tap the floating pill overlay |
Both triggers can be configured via config.triggers.
The central hub for all PhantomSwift modules. A Niagara-style AβZ scrollable grid displays every available module with a glassmorphic card UI.
The dashboard provides quick access to all 25 modules. Each card shows the module icon, name, and a brief description. Enabled modules are highlighted with a colored accent glow.
Automatically captures all HTTP/HTTPS traffic via URLProtocol swizzling. Provides a detailed view of every request and response flowing through your app.
Capabilities:
- Full request/response body inspection with JSON pretty-printing
- Status code color-coding (2xx green, 4xx orange, 5xx red)
- Header inspection with copy-to-clipboard
- Text search and status code filtering
- HAR 1.2 export for sharing with backend teams
- Request edit & replay
- Automatic content-type detection (JSON, XML, HTML, image)
Create rules to intercept matching network requests. Supports multiple interception strategies to simulate various backend scenarios without modifying server code.
Rule Types:
| Type | Description |
|---|---|
| Mock | Return a custom JSON/text response body |
| Block | Prevent the request from executing entirely |
| Redirect | Forward to a different URL (e.g., Mockoon server) |
| Delay | Add artificial latency (100ms β 30s) |
Features:
- URL pattern matching with wildcards
- Hit counter per rule
- Exclude patterns to bypass specific endpoints
- Per-rule enable/disable toggle
- Import/export rule sets
Simulate poor network conditions to test your appβs resilience β no proxy tools or extra setup required.
Presets:
| Profile | Latency | Throughput | Packet Loss |
|---|---|---|---|
| WiFi | 2ms | Unlimited | 0% |
| 4G/LTE | 50ms | 12 Mbps | 1% |
| 3G | 200ms | 1.6 Mbps | 2% |
| Edge | 400ms | 240 Kbps | 5% |
| GPRS | 500ms | 50 Kbps | 10% |
| Offline | β | 0 | 100% |
All parameters (latency, throughput, packet loss) are individually adjustable with sliders for custom profiles.
Chrome DevTools-style waterfall timeline showing request durations and concurrency β a visual overview of how your network requests overlap in time.
What it shows:
- DNS lookup, connection, SSL, TTFB, and content download phases
- Concurrent request overlap visualization
- Color-coded bars by content type (API, image, script)
- Total page load time calculation
- Tap any bar to jump to the full request detail
Real-time CPU, FPS, and RAM tracking with interactive timeline graphs. Spot performance bottlenecks as they happen.
Metrics tracked:
- CPU Usage β per-process CPU utilization percentage
- FPS β frames per second from
CADisplayLink(drops highlighted in red) - Memory β resident set size (RSS) in MB with peak tracking
- Thermal State β device thermal state monitoring (nominal β critical)
Interactive timeline lets you scrub through the last 60 seconds of data. Anomalies (FPS drops, CPU spikes, memory warnings) are highlighted with markers.
A priority-level logging system with tags, metadata, and full-text search. Replaces print() with structured, filterable output.
Usage:
#if DEBUG
PhantomLog.debug("View loaded", tag: "UI")
PhantomLog.info("User signed in", tag: "Auth")
PhantomLog.warning("Cache miss for key: \(key)", tag: "Cache")
PhantomLog.error("Failed to decode response", tag: "Network")
#endifFeatures:
- Five priority levels:
verbose,debug,info,warning,error - Tag-based filtering (e.g., show only "Network" logs)
- Full-text search across all log entries
- Timestamp with millisecond precision
- Export logs as text file
- OSLog bridge for unified logging (iOS 14+)
- Plug-and-play
WKWebViewconsole capture forconsole.log,console.warn,console.error, and JS bridge payloads
Plug-and-play for hybrid HTML/native apps:
After PhantomSwift.launch(), new WKWebView instances are instrumented automatically when the
Logger module is enabled. That means browser-side logs like console.log("bridge ready") and
console.error("checkout failed", payload) will appear in PhantomSwift's Console Logger
without you wiring each web view manually.
If you want explicit control over handler naming or tagging, you can still install the bridge yourself:
import WebKit
#if DEBUG
import PhantomSwift
#endif
final class CheckoutWebVC: UIViewController {
#if DEBUG
private let phantomConsoleBridge = PhantomWebViewConsoleBridge(
configuration: .init(handlerName: "phantomConsole", tag: "CheckoutJS")
)
#endif
private lazy var webView: WKWebView = {
let configuration = WKWebViewConfiguration()
#if DEBUG
phantomConsoleBridge.install(into: configuration)
#endif
return WKWebView(frame: .zero, configuration: configuration)
}()
}If you already have your own JS bridge, you can also forward messages manually from native:
#if DEBUG
PhantomWebViewConsoleBridge.capture(
level: .error,
message: "window.checkoutBridge rejected payload",
tag: "CheckoutJS",
sourceURL: webView.url?.absoluteString
)
#endifYou can disable the automatic mode if your host app needs stricter ownership over WKWebView setup:
#if DEBUG
PhantomSwift.configure { config in
config.enableAutomaticWebViewConsoleBridge = false
}
#endifInspect any view in your app hierarchy β tap to select, view properties, constraints, and spatial relationships. The 3D exploded view provides an Xcode-style visualization of the entire view tree.
UI Inspector features:
- Tap-to-select any view in the hierarchy
- Property inspection: frame, bounds, alpha, backgroundColor, accessibilityLabel
- Constraint list with priority, constant, multiplier
- Live editing of properties (frame, alpha, backgroundColor)
- Measurement tool β measure distance between any two views
3D Hierarchy features:
- Exploded 3D view with adjustable spacing
- Depth filter slider to focus on specific layers
- Rotate X/Y sliders for precise camera control
- Wireframe mode to see layout structure
- Class name labels overlay
- Tap any layer to open the inspector sheet
- Pinch to zoom, 1-finger pan, 2-finger orbit
- Fit All & Reset camera controls
- Mini-map overlay for orientation
Automatic retain cycle detection with object lifecycle tracking. The memory graph visualizes object relationships to help identify where leaks occur.
Leak Tracker:
- Tracks
UIViewControllerandUIViewlifecycle via swizzling - Detects objects that are not deallocated after dismissal (potential leaks)
- Shows class name, allocation time, and retain count
- Configurable detection delay (default: 3s after dismissal)
Memory Graph:
- Visual directed graph of object references
- Interactive nodes β tap to inspect properties
- Snapshot comparison (diff between two heap states)
- Highlights potential retain cycles with red edges
Browse and edit all local storage mechanisms from a single interface.
Supported storage types:
| Storage | Capabilities |
|---|---|
| UserDefaults | Browse, edit, delete keys. Type-aware editing (String, Int, Bool, Date, Array, Dictionary) |
| Keychain | Read and delete keychain items. Filtered by appβs access group |
| Sandbox Files | Navigate the appβs Documents, Library, and tmp directories. View file contents, sizes, dates |
| SQLite | Browse tables, execute raw SQL queries, view schema |
All edits are reflected immediately β no app restart needed.
Intercept and inspect analytics events from any provider without modifying your analytics code.
Supported providers:
- Firebase Analytics
- Amplitude
- Mixpanel
- Custom event buses
Features:
- Real-time event feed with timestamp, name, and parameters
- Group-by-provider view to see event distribution
- Search and filter by event name or parameter value
- Event validation β warns about missing required parameters
Runtime feature flag management with a beautiful grouped UI. Toggle features on-the-fly without recompilation.
#if DEBUG
// Register flags at launch
PhantomFeatureFlags.shared.register(key: "new_onboarding", title: "New Onboarding Flow",
defaultValue: false, group: "UX")
PhantomFeatureFlags.shared.register(key: "dark_mode_v2", title: "Dark Mode V2",
defaultValue: true, group: "Theme")
// Check flags anywhere
if PhantomFeatureFlags.shared.isEnabled("new_onboarding") {
showNewOnboarding()
}
#endifFeatures:
- Register flags with key, title, description, default value, and group
- Toggle overrides from the dashboard with immediate effect
- Overrides persist across app launches via UserDefaults
- Reset individual flags or all at once
- Override badge count shown on the dashboard card
Comprehensive security analysis of your appβs runtime environment.
Checks performed:
| Check | Description |
|---|---|
| Jailbreak Detection | Checks for Cydia, unusual paths, writable system dirs |
| SSL Pinning | Validates certificate pinning implementation |
| Debugger Detection | Detects if a debugger is attached |
| Binary Integrity | Checks code signature and encryption status |
| Keychain Security | Validates keychain access control settings |
| App Transport Security | Checks ATS exceptions in Info.plist |
Results are color-coded: π’ Pass, π‘ Warning, π΄ Fail β with remediation suggestions.
Audit image and video assets for memory optimization, sizing, and potential issues.
Analysis includes:
- Image dimensions vs. display size (flags oversized images)
- Memory footprint calculation per asset
- Format identification (PNG, JPEG, HEIF, WebP, PDF)
- Missing @2x/@3x variants detection
- Total asset catalog size summary
Override device environment settings for testing β no need to physically move or change device settings.
Capabilities:
- GPS Spoofing β Set custom coordinates for location-dependent features
- Locale Override β Change app locale without changing device settings
- Battery Monitoring β Real-time battery level and charging state
- Thermal State β Monitor device temperature state
- Time Zone Override β Test time-sensitive features across zones
Browse Objective-C classes, methods, and properties at runtime β a powerful introspection tool for understanding third-party SDKs.
Features:
- Browse all loaded Objective-C classes
- Inspect instance methods, class methods, and properties
- View method signatures and return types
- Search by class name or method name
- Filter by framework/module
Detects Auto Layout constraint conflicts in real-time and displays them in a clear, actionable format.
Features:
- Captures
UIViewAlertForUnsatisfiableConstraintsbreakpoint output - Parses conflicting constraint sets into readable format
- Shows which views and constraints are involved
- Suggests which constraint to remove or lower priority
Simulate and test push notifications locally without a backend or APNs configuration.
Features:
- Create custom notification payloads (title, body, badge, sound)
- Schedule local notifications with configurable delay
- Test deep link routing from notification taps
- Preview notification appearance before sending
Test URL schemes and universal links without leaving the app.
Features:
- Input any URL scheme or universal link
- Execute deep links within the app context
- History of recently tested links
- Quick-access bookmarks for frequently tested routes
Start a WebSocket server on the device. Connect from any WebSocket client (browser, Postman, custom tool) and query your appβs state in real time.
#if DEBUG
if #available(iOS 13.0, *) {
PhantomRemoteServer.shared.start(port: 9876)
}
// Connect from browser: ws://<device-ip>:9876
// Send JSON: {"command": "logs"} or {"command": "network-trace"}
#endifAvailable Commands:
| Command | Description |
|---|---|
app-info |
App bundle info, device model, iOS version |
system-status |
CPU, memory, disk usage |
logs |
Last 50 log entries |
network-trace |
Last 50 network requests |
feature-flags |
All registered feature flags |
toggle-flag |
Toggle a feature flag (params: key) |
performance |
Current metrics + 30-sample history |
clear-logs |
Clear the log store |
clear-network |
Clear captured network requests |
help |
List available commands |
A built-in web echo page is included at Resources/web-echo/index.html for quick browser-based testing.
Sources/PhantomSwift/
βββ Core/ # Framework core
β βββ PhantomSwift.swift # Main entry point & setup
β βββ PhantomFeature.swift # Feature enum (25 cases)
β βββ PhantomEventBus.swift # Thread-safe event system
β βββ PhantomConfig.swift # Configuration struct
β βββ PhantomEnvironment.swift # Environment enum
β βββ PhantomPlugin.swift # Plugin protocol
βββ HUD/ # Dashboard & presentation
β βββ PhantomDashboardVC.swift # Niagara-style AβZ dashboard
β βββ PhantomTheme.swift # Glassmorphic design tokens
β βββ PhantomHUDWindow.swift # Overlay window management
β βββ PhantomGestureHandler.swift # Shake/Dynamic Island trigger
β βββ PhantomDynamicIsland.swift # Dynamic Island floating pill
βββ Modules/ # Feature modules
β βββ Network/ # Network trace, waterfall, HAR, replay
β βββ Interceptor/ # Request mocking & redirection
β βββ Logger/ # Console logger with levels & tags
β βββ Performance/ # CPU/FPS/RAM monitor & timeline
β βββ MemoryLeak/ # Leak tracker & object graph
β βββ UIInspector/ # UI inspection & 3D hierarchy
β βββ Storage/ # UserDefaults, Keychain, SQLite, Sandbox
β βββ QA/ # Bug reporter, macro recorder, shortcuts
β βββ Security/ # Security audit & checks
β βββ Analytics/ # Analytics event interceptor
β βββ SwiftUI/ # Render body tracker
β βββ FeatureFlags/ # Feature flag management
β βββ MainThreadChecker/ # Background thread violation detection
β βββ RuntimeBrowser/ # ObjC runtime introspection
β βββ Assets/ # Asset inspector & optimization
β βββ Remote/ # WebSocket debug server
β βββ Core/ # Extension bus & shared module utils
βββ Shared/ # Shared utilities
βββ Components/ # Reusable UI (PhantomTableVC, badges, code view)
βββ Extensions/ # UIColor+Phantom, UIFont+Phantom, etc.
βββ Helpers/ # Swizzler, formatters, utilities
| Pattern | Usage |
|---|---|
| Singletons | Module managers (PhantomLog.shared, PhantomFeatureFlags.shared) |
| Event Bus | PhantomEventBus for decoupled module communication |
| Thread Safety | DispatchQueue(attributes: .concurrent) with .barrier writes |
| Base VC | PhantomTableVC for consistent list UIs across modules |
| Theme System | PhantomTheme for centralized styling β never hardcode colors |
| Swizzler | PhantomSwizzler for safe method swizzling |
PhantomSwift.configure { config in
// Environment (default: .dev)
config.environment = .dev // .dev | .staging | .release
// Dashboard triggers
config.triggers = [.shake, .dynamicIsland]
// Theme
config.theme = .dark // .dark | .light | .auto
// Custom QA shortcuts
config.shortcuts = [
AppShortcut(title: "Reset Onboarding") {
UserDefaults.standard.removeObject(forKey: "hasSeenOnboarding")
},
AppShortcut(title: "Force Crash") {
fatalError("Debug crash triggered")
}
]
}| Option | Type | Default | Description |
|---|---|---|---|
environment |
PhantomEnvironment |
.dev |
Current build environment |
triggers |
[PhantomTrigger] |
[.shake] |
How to open the dashboard |
theme |
PhantomThemeMode |
.dark |
UI theme mode |
shortcuts |
[AppShortcut] |
[] |
Custom QA actions in dashboard |
| Requirement | Minimum |
|---|---|
| iOS | 12.0+ |
| Swift | 5.9+ |
| Xcode | 15.0+ |
| Dependencies | None |
iOS Compatibility Notes:
- iOS 12β12.x: Core functionality works. SF Symbols replaced with text/Menlo fallbacks.
- iOS 13+: Full SF Symbols,
UINavigationBarAppearance, monospaced digit fonts.- iOS 13+: Remote WebSocket Server requires
Network.framework(NWListener).- iOS 14+: OSLog bridge for unified logging.
Swift Compatibility Notes:
- Swift 5.x: PhantomSwift is maintained in the Swift 5 family.
- Swift 5.9+: Current package manifest, CocoaPods spec, CI verification, and documentation are validated against Swift 5.9+ toolchains.
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch:
git checkout -b feature/my-feature - Commit with clear messages:
git commit -m "Add: macro recorder export as JSON" - Push to your fork:
git push origin feature/my-feature - Open a Pull Request
- Wrap ALL code in
#if DEBUG/#endif - Use
PhantomTheme.sharedfor colors/fonts β never hardcode - Use
[weak self]in closures that may outlive the caller - No force unwraps (
!) β useguard/if let - Use
PhantomSwizzlerfor method swizzling - Prefix public types with
Phantom - Build UI programmatically β no storyboards or XIBs
- Use
NSLayoutConstraint.activate([...])for Auto Layout - Wrap iOS 13+ APIs in
if #available(iOS 13.0, *)
PhantomSwift is released under the MIT License. See LICENSE for details.
Built with precision for iOS engineers who demand the best debugging tools.































