The ultimate companion for InjectionNext in VS Code. Automatically generate and clean up SwiftUI hot-reloading boilerplate with a single command or shortcut, with smart integration with the InjectionNext macOS app.
🚀 Key Features
- ⚡ Automatic Boilerplate Generation: Instantly inject
import Inject,@ObserveInjection var inject, and.enableInjection()into your SwiftUI views with a single tap or keyboard shortcut (cmd + alt + i). - 🗑️ Automatic Boilerplate Removal: Completely clean up and remove all injection boilerplate from your SwiftUI files with a single tap or keyboard shortcut (
cmd + alt + k). - 📶 Smart Status Monitoring: Real-time status indicator in the Status Bar showing whether InjectionNext is running and active on your project.
- 👁️ Auto-Watch Project: Automatically registers your project workspace with InjectionNext on startup.
- 🔗 Direct App Integration: Launch InjectionNext directly from VS Code with a single click if it is not currently running.
- 📶 Unified Companion Panel: A custom Activity Bar sidebar representing the complete companion interface to supervise compilation, connected clients, and live status.
- ⏺️ Touch Event Recorder (Macro): Record live touch interaction events from your connected app, clear recorded events, and replay them sequentially to instantly recreate specific UI states after a hot reload.
🚦 Status Bar States
$(zap) InjectionActive: Everything is ready! App is running and watching your project.$(eye) Watch Project?: App is running, but this project isn't being watched. Click to activate.$(warning) InjectionNext Off: App is not running. Click to launch it.
How It Works
The extension parses your active SwiftUI View and intelligently inserts three core elements:
import Inject- Placed automatically in alphabetical order within your
importblock.
- Placed automatically in alphabetical order within your
@ObserveInjection var inject- Inserted into the first struct conforming to
View(ex. 'View', custom protocol like 'WrappedView' or 'ThemeableView').
- Inserted into the first struct conforming to
.enableInjection()- Placed as the last modifier of your main
bodyproperty.
- Placed as the last modifier of your main
Usage & Shortcuts
1. Editor Toolbar Icons
- Click ⚡ to Generate Swift Injection.
- Click 🗑️ to Remove Swift Injection.
2. Keyboard Shortcuts
- Generate:
cmd + alt + i - Remove:
cmd + alt + k
Installation
1. From IDE (VS Code, Cursor, Kiro, Antigravity, or any Forked VS Code) Extension Marketplace (Recommended)
- Open IDE.
- Open Extensions view (
Cmd+Shift+X). - Search for Pamungkas.swift-injection-generator.
- Click Install.
2. Manual Installation (From Source)
- Clone or copy the extension folder.
- Run compilation & packaging in the directory:
npm install npm run compile npx @vscode/vsce package - Install the generated
.vsixfile in VS Code:- Go to Extensions (
Cmd+Shift+X). - Click the
...menu in the top-right. - Choose Install from VSIX...
- Select
swift-injection-generator-xxx.vsix.
- Go to Extensions (
Requirements
- VS Code
v1.80.0or newer. - Swift language package installed for syntax detection.
License
This extension is open-sourced under the MIT License.