- Home
- Skills
- Mobile Development
- Swift/Xcode Audit: iOS and SwiftUI Code Review
Swift/Xcode Audit: iOS and SwiftUI Code Review
by Hatim Lk
A prioritized audit of an iOS, Swift or SwiftUI project: secrets, crash risks, threading, memory leaks, SwiftUI pitfalls, performance and architecture, each finding with file, line, evidence and fix.
$7
Swift/Xcode Audit: iOS and SwiftUI Code Review
Example session with this skill installed
Audit my SwiftUI weather app in ./WeatherApp. What could crash or leak before I ship?
- Read your context and instructions
- Compiled the swift xcode audit
Summary
3 files audited.
2 P0 (a hardcoded API key, crash paths),
3 P1 (a timer that never stops, a sheet that can crash, a timing hack). Fix the P0s before shipping.
Scan
$ grep -rn "anonKey\|apiKey\|secret\|Bearer\|password" --include="*.swift" WeatherApp
WeatherApp/WeatherService.swift:5: private let apiKey = "wx_demo_key_not_real"
WeatherApp/WeatherService.swift:8: let url = URL(string: "https://api.example-weather.com/v1/\(city)?key=\(apiKey)")!
$ grep -rn "fatalError" --include="*.swift" WeatherApp
WeatherApp/Persistence.swift:8: if let error { fatalError("Store failed: \(error)") }
$ grep -rn "Timer\.publish\|Timer\.scheduled" --include="*.swift" WeatherApp
WeatherApp/ForecastView.swift:8: let timer = Timer.publish(every: 1, on: .main, in: .common).autoconnect()
$ grep -rn "sheet(isPresented:" --include="*.swift" WeatherApp
WeatherApp/ForecastView.swift:15: .sheet(isPresented: $showDetails) { DetailsView(forecast: forecast!) }
$ grep -rn "asyncAfter" --include="*.swift" WeatherApp
WeatherApp/ForecastView.swift:19: DispatchQueue.main.asyncAfter(deadline: .now() + 2) { print("refresh") }
Findings
[P0] API key hardcoded in the app binary
File: WeatherService.swift line 5
Evidence: private let apiKey = "wx_demo_key_not_real"
Impact: anyone can extract it from the IPA and use your quota.
Fix: move the call behind your own backend, or fetch a short-lived token at runtime. Rotate the key.
[P0] Crash paths on network and disk errors
File: WeatherService.swift lines 8 and 11, Persistence.swift line 8
Evidence: URL(string: ...)!, try! JSONDecoder().decode(...), data!, fatalError("Store failed")
Impact: a bad response, offline launch or corrupt store crashes the app.
Fix: guard let the URL and data, do/catch the decode, and show an error state; recover the Core Data store instead of fatalError.
[P1] Timer never cancelled
File: ForecastView.swift line 8
Evidence: Timer.publish(every: 1, ...).autoconnect() stored on the view
Impact: fires every second for the view's lifetime and re-renders it; leaks if the view is recreated.
Fix: use TimelineView(.periodic(from: .now, by: 1)), or cancel the subscription in .onDisappear.
[P1] Sheet can open with nil data
File: ForecastView.swift line 15
Evidence: .sheet(isPresented: $showDetails) { DetailsView(forecast: forecast!) }
Impact: tapping Details before the forecast loads crashes.
Fix: .sheet(item: $selectedForecast) so the sheet only exists with data.
[P1] Timing hack instead of a real refresh
File: ForecastView.swift line 19
Evidence: DispatchQueue.main.asyncAfter(deadline: .now() + 2)
Impact: races the network call; does nothing useful.
Fix: refresh with .refreshable or .task and async/await.
Next steps
- Fix the two P0s and rotate the key.
- Replace the timer and sheet patterns.
- Re-run the scan; the P0 searches should return nothing.
Connects securely to your tools. The creator never sees your data.
About this skill
What it does
Runs a structured code audit of an iOS / Swift / SwiftUI / Xcode project and reports findings by severity, so you fix what can crash or leak first.
Checklist, in priority order
- P0 Security: hardcoded API keys, tokens and passwords
- P0 Crash risks:
fatalError, force unwraps,try! - P1 Threading and concurrency: main-thread UI updates,
asyncAftertiming hacks, races - P1 Memory: retain cycles, timers and subscriptions never cancelled
- P1 SwiftUI:
.sheet(isPresented:)races, state misuse, god views - P1 Performance, P2 Architecture, Data and persistence, Error handling, P3 Code quality
Each finding comes with the file and line, the exact code as evidence, the impact, and a concrete fix.
Search commands included: ready-to-run grep and find commands for prints, fatalError, asyncAfter, timers, singletons, force unwraps, secrets, sheet patterns, file sizes and dead files.
Requirements
Nothing to install: the agent reads your code and runs standard shell commands (macOS or Linux).
Used on a real app
Used to audit Glood (glood.app), a SwiftUI app for iPhone and iPad, now in public beta.
Cannot perform runtime profiling or dynamic analysis. Relies on static analysis of Swift files and project structure. Requires shell access to run grep and wc commands.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 4 days ago
Permissions
What's inside
Frequently Asked Questions
New in Mobile Development
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Mobile Development.