How stephendev0/stikdebug-legacy works
1. What this repo is
- StikDebug is an iOS-first, on-device utility app built in Swift/SwiftUI.
- Its core purpose is to connect to the current device, inspect it, and perform debug-oriented actions such as JIT enabling, process inspection, app launching, console logging, and location simulation.
- The architecture is centered around local device control rather than any backend service.
2. Top-level app composition
- The app entry point is StikDebugApp.swift, with AppBootstrapper.swift and AppFeature.swift acting as the startup/coordinator layer.
- The main user experience is tab-based (MainTabView.swift) and is split into feature screens such as Home, Installed Apps, Console Logs, Tools, Settings, Profile, and Process Inspector.
- This suggests a feature-oriented UI with shared app state/services feeding multiple tabs.
3. Device connectivity is the core subsystem
- The most important boundary in the repo is between the Swift app and the device-level native bridge.
- StikDebug/idevice contains a bundled C library interface (libidevice_ffi.a, idevice.h, module.modulemap) used to talk to Apple device services.
- Higher-level Swift wrappers (IdeviceFFIBridge.swift, DeviceConnectionContext.swift, DeviceInfoManager.swift, JITEnableContext.swift) abstract the raw FFI into app-safe workflows.
4. Pairing, tunneling, and DDI mounting
- The app relies on a pairing file (PairingFileStore.swift) to authenticate against the device.
- TunnelManager.swift and the README’s loopback VPN requirement indicate the app depends on a local tunnel/VPN path to reach device services on iOS 17.4+.
- DeveloperDiskImageService.swift and mountDDI.swift handle Developer Disk Image-related setup, which is typically required for deeper device interaction and JIT-related capabilities.
- MountingProgress.swift and related contexts imply this setup is asynchronous and surfaced to the UI as progress state.
5. JIT enablement workflow
- The flagship action is enabling JIT for sideloaded apps.
- The flow is: select a paired device, establish the tunnel/connection, mount required disk image/services if needed, then enable JIT for a chosen installed app.
- InstalledAppsViewModel.swift, InstalledAppListItem.swift, and InstalledAppRows.swift drive the app-selection UI, while JITEnableContext.swift likely coordinates the activation sequence.
6. Installed apps and app metadata
- The Installed Apps feature is its own subsystem, not just a UI list.
- AppIconRepository.swift and AppStoreIconFetcher.swift indicate the app enriches local installed-app records with icons/metadata.
- The app can launch installed apps and appears to track app expiry/profile-related state, which matches the README’s “App Expiry” feature.
7. Console, logs, and process inspection
- ConsoleLogsView.swift, SystemLogStream.swift, and LogManager.swift provide live log streaming from both apps and the system.
- ProcessInspectorView.swift suggests the app can enumerate running processes, inspect them, and potentially terminate them.
- These are device-sourced streams/actions, so the data flow is from the device bridge into log/process views rather than from local persistence.
8. Script management and JavaScript support
- JSSupport is a separate subsystem for managing and running JS-based automation.
- ScriptStore.swift, ScriptListView.swift, ScriptEditorView.swift, and RunJSView.swift provide script lifecycle management and execution UI.
- AutoScriptAssignments.swift suggests scripts can be bound to specific apps or conditions, which is useful for JIT automation flows.
- The bundled scripts in Scripts/ (Geode.js, UTM-Dolphin.js, maciOS.js, universal.js) show that the system ships with predefined automation recipes.
9. Device utility services
- Several services support the app’s “keep the device usable while debugging” behavior:
- BackgroundAudioManager.swift
- BackgroundLocationManager.swift
- DebugKeepAliveLease.swift
- AccessibilityAnnouncer.swift, Haptics.swift, and AlertPresenter.swift for user feedback
- MapSelectionView.swift and the README’s “Location Simulator” feature indicate a location spoofing/simulation flow backed by those services.
10. Shared support layer
- The Support/ folder contains cross-cutting helpers and app infrastructure: file lookup, document picker copying workaround, notification names, user defaults keys, localization, and codable app storage helpers.
- ScriptStore, PairingFileStore, and related types likely provide the local persistence boundary for pairing files, scripts, and configuration state.
- This layer keeps storage/UI/device-bridge concerns separated from the feature screens.
11. Feature and view organization
- The Features/ and Views/ folders show a modular split between domain logic and screens.
- HomeView, InstalledAppsListView, ToolsView, SettingsView, ProfileView, and MapSelectionView are the primary user-facing surfaces.
- HomeExternalAction.swift suggests the home screen can react to external triggers or system events.
12. Platform and build boundaries
- This is an Xcode-based iOS app (StikDebug.xcodeproj) with SwiftPM integration and explicit entitlements (StikDebug.entitlements).
- The project includes tests (StikDebugTests, StikDebugUITests) and a DebugWidgetExtension scheme, implying some auxiliary target support.
- Assets, localization, and Info.plist are standard app packaging pieces, but the key architectural constraint is device-level capability access through signing/entitlements.
13. Automation and release infrastructure
- GitHub Actions workflows (build_ipa.yml, updatesource.yml) indicate the repo has CI for building distributable IPAs and syncing/updating source-related outputs.
- The README’s distribution paths (AltSource/direct IPA) reinforce that this project is meant to be built and shipped as an installable iOS app, not deployed as a server.
14. Overall architecture in one sentence
- StikDebug is a feature-based SwiftUI iOS app whose UI tabs drive a device-control backend built on an idevice FFI bridge, with supporting services for pairing, tunneling, DDI mounting, JIT activation, logging, script automation, and device utility features.
Main entry points: MainTabView.swift Main tabs · DeviceConnectionContext.swift Device context · JITEnableContext.swift JIT flow · JSDebugSupport.swift JS support
Components 33
App Shell
App entry, bootstrap, and primary navigation.
- App entry · Application entry point and root lifecycle.
StikDebug/App/StikDebugApp.swift - Bootstrapper · Initial app setup and dependency wiring.
StikDebug/App/AppBootstrapper.swift - App feature · Top-level feature/state composition for the app.
StikDebug/App/AppFeature.swift
Device Control
FFI bridge and device workflows for pairing, tunneling, mounting, and JIT.
- FFI bridge · Swift wrapper over bundled idevice FFI.
StikDebug/Device/IdeviceFFIBridge.swift - Device context · High-level device connection/session state.
StikDebug/Device/DeviceConnectionContext.swift - Device info · Device discovery and metadata management.
StikDebug/Device/DeviceInfoManager.swift - JIT flow · Coordinates JIT enablement for selected apps.
StikDebug/Device/JITEnableContext.swift - Mount progress · Asynchronous state for DDI mounting and setup.
StikDebug/Device/MountingProgress.swift - Log stream · Streaming source for system and app console logs.
StikDebug/Device/SystemLogStream.swift - Mount DDI · Developer Disk Image mounting entry point.
StikDebug/Device/mountDDI.swift
Features
Feature-specific state and list/detail logic.
JSSupport
Script management and JavaScript execution.
- JS support · Script execution and automation support layer.
StikDebug/JSSupport/JSDebugSupport.swift
Services
Device utility services and background helpers.
- Tunnel · Manages the local tunnel/VPN path to device services.
StikDebug/Services/TunnelManager.swift - DDI service · Coordinates developer disk image availability and mounting support.
StikDebug/Services/DeveloperDiskImageService.swift - Store fetcher · Fetches app-store-style icon or metadata enrichment.
StikDebug/Services/AppStoreIconFetcher.swift - Background audio · Keeps device/audio behavior usable during debugging.
StikDebug/Services/BackgroundAudioManager.swift - Background location · Supports location simulation and background location behavior.
StikDebug/Services/BackgroundLocationManager.swift - Keep alive · Debug-session keep-alive lease and coordination.
StikDebug/Services/DebugKeepAliveLease.swift
Support
Shared storage, UI helpers, and app-wide utilities.
- Pairing store · Local storage for pairing artifacts and trust data.
StikDebug/Support/PairingFileStore.swift - Script store · Stores scripts and related script metadata locally.
StikDebug/Support/ScriptStore.swift - Auto scripts · Binds scripts to apps or conditions.
StikDebug/Support/AutoScriptAssignments.swift - Log manager · Central coordinator for log lifecycle and presentation.
StikDebug/Core/LogManager.swift - Alerts · Shared alert presentation helper.
StikDebug/Support/AlertPresenter.swift
Views
Primary user-facing screens.
- Main tabs · Primary navigation container for the app screens.
StikDebug/Views/MainTabView.swift - Home · Landing screen for device status and entry actions.
StikDebug/Views/HomeView.swift - Installed apps · Browser for installed apps and JIT-related actions.
StikDebug/Views/InstalledAppsListView.swift - Tools · Entry screen for device tools and maintenance actions.
StikDebug/Views/ToolsView.swift - Settings · App and connection settings surface.
StikDebug/Views/SettingsView.swift - Profile · User/profile or device identity-related screen.
StikDebug/Views/ProfileView.swift - Console logs · Live device and app log inspection UI.
StikDebug/Views/ConsoleLogsView.swift - Processes · Running process inspection and control UI.
StikDebug/Views/ProcessInspectorView.swift - Location · Location simulation and selection UI.
StikDebug/Views/MapSelectionView.swift
Connections 34
- App entry → Bootstrapper: boots · App startup is delegated to the bootstrapper.
- Bootstrapper → App feature: configures · Bootstrapper wires top-level app state and dependencies.
- App feature → Main tabs: drives · App feature feeds the tab shell and navigation state.
- Main tabs → Home: shows · Primary navigation includes the home screen.
- Main tabs → Installed apps: shows · Primary navigation includes installed apps.
- Main tabs → Tools: shows · Primary navigation includes tools.
- Main tabs → Settings: shows · Primary navigation includes settings.
- Main tabs → Profile: shows · Primary navigation includes profile.
- Main tabs → Console logs: shows · Primary navigation includes logs.
- Main tabs → Processes: shows · Primary navigation includes process inspection.
- Main tabs → Location: shows · Primary navigation exposes location simulation.
- Device context → FFI bridge: uses · Session-level device access is mediated by the bridge.
- Device context → Pairing store: loads · Connection setup depends on stored pairing data.
- Device context → Tunnel: connects · Device services are reached through the local tunnel path.
- Device context → DDI service: requests · Device setup can require developer disk image support.
- DDI service → Mount DDI: mounts · Service delegates the actual DDI mount workflow.
- Mount DDI → Mount progress: reports · Mounting is surfaced through progress state.
- JIT flow → Device context: depends on · JIT enablement runs on an active device session.
- JIT flow → Mount DDI: prepares · JIT workflow may require DDI mounting first.
- JIT flow → Apps VM: targets · JIT activation is initiated from the installed apps feature.
- Apps VM → Icon repo: enriches · Installed apps are decorated with icons and metadata.
- Icon repo → Store fetcher: fetches · Icon repository can pull remote/store-style metadata.
- Console logs → Log stream: subscribes · Console UI consumes the live device log stream.
- Log stream → Log manager: coordinates · Log lifecycle is coordinated centrally.
- Processes → FFI bridge: inspects · Process inspection is backed by the device bridge.
- Location → Background location: drives · Location UI controls the background location service.
- Home → Keep alive: uses · Home/actions surface keep-alive state for debug sessions.
- Tools → Background audio: uses · Tools expose background audio support.
- Tools → Background location: uses · Tools expose location simulation support.
- JS support → Script store: loads · Script runtime reads stored scripts and metadata.
- JS support → Auto scripts: applies · Runtime can apply app/condition-based script assignments.
- JS support → Device context: executes on · Automation runs against the connected device session.
- Settings → Pairing store: manages · Settings surface pairing and local configuration state.
- Alerts → Home: notifies · Shared alerts can surface on the home experience.