SwiftUI Autotest Skill
Open-source Agent Skills for automated visual testing and accessibility setup of iOS/SwiftUI applications using Claude Code's computer use.
Build, launch in the Simulator, visually test every screen, detect crashes, analyze memory leaks, and add accessibility identifiers — all from the terminal, in a single command.
Quick Start
Install both skills:
npx skills add https://github.com/yusufkaran/swiftui-autotest-skill
Then open your SwiftUI project in Claude Code and say:
Use the /ios-test skill to build the app, launch it in the Simulator, and test all screens.
The agent will find your .xcodeproj, select a Simulator, build and install the app, navigate through every screen with computer use, screenshot each state, and produce a test report. No code is modified unless you explicitly approve changes.
Prerequisites: Enable Computer Use
/ios-test requires Claude Code's computer use feature to see and interact with your screen. This is a one-time setup:
-
Enable the MCP server — In Claude Code, run:
/mcp
Find computer-use in the list and select Enable.
-
Grant macOS permissions — The first time computer use runs, macOS will ask for two permissions:
- Accessibility — lets Claude click, type, and scroll
- Screen Recording — lets Claude see your screen
Grant both in System Settings > Privacy & Security. You may need to restart Claude Code after granting Screen Recording.
-
Requirements:
- macOS only (not available on Linux/Windows)
- Claude Code v2.1.85 or later (
claude --version to check)
- Pro or Max plan (not available on free, Team, or Enterprise plans)
- Interactive session (not available with the
-p flag)
Note: /add-accessibility does not require computer use — it only reads and edits source files.
Why Visual Testing Matters
Unit tests verify logic. UI tests verify layouts, navigation, and user flows — but writing them takes time and maintaining them takes more. Computer use lets Claude see and interact with your app the way a real user would, without a single line of test code.
Accessibility identifiers make this faster and more reliable — and they also make your app work with VoiceOver, which is a requirement for many App Store categories.
How It Works
/ios-test /add-accessibility
│ │
├─ Find .xcodeproj/.xcworkspace ├─ Scan all SwiftUI files
├─ Select Simulator (smart logic) ├─ Find interactive elements
├─ Build with xcodebuild ├─ Skip elements that already
├─ Install & launch app │ have identifiers
├─ Computer use: navigate & test ├─ Generate {screen}-{type}-{name}
├─ Screenshot each screen ├─ Add .accessibilityIdentifier()
├─ Check crash logs ├─ Flag Dynamic Type issues
├─ (optional) State testing └─ Summary report
├─ (optional) Performance analysis
└─ Test report
The recommended workflow: run /add-accessibility first to make your views identifiable, then run /ios-test to test them.
What It Checks
| Check | What the agent looks for |
|---|
| Screen rendering | Layout overflow, overlapping views, empty areas, truncated text |
| Navigation | Every TabView tab, every NavigationLink, back navigation |
| Interactive elements | Buttons respond to taps, toggles switch, sliders move |
| Crash detection | Simulator crash logs analyzed with stack traces and source references |
| Empty state | Meaningful message shown when no data is available |
| Error state | Clear error message with retry option |
| Loading state | Loading indicator visible, UI not frozen |
| Memory usage | RAM footprint per screen, before/after comparison on navigation |
| Memory leaks | leaks command on running process, retain cycle detection |
| Accessibility gaps | Missing identifiers on Button, TextField, Image, Toggle, Picker, etc. |
| Dynamic Type | Missing lineLimit, minimumScaleFactor, hardcoded font sizes |
Included Skills
| Skill | Command | Purpose |
|---|
| iOS Test | /ios-test | Build, launch, visually test with computer use, crash logs, state testing, performance analysis |
| Add Accessibility | /add-accessibility | Scan SwiftUI views and add {screen}-{type}-{name} accessibility identifiers |
Usage
/ios-test
# Test all screens (default)
/ios-test
# Test a specific user flow
/ios-test --flow=onboarding
# Test a specific screen
/ios-test --screen=LoginView
# Choose a Simulator device
/ios-test --device="iPhone 16"
# Specify Xcode scheme
/ios-test --scheme=MyApp