How to stop your agent from hallucinating SwiftUI APIs
When to use: Agent suggests APIs that don't exist in the iOS version you target.
Prerequisites
- Node 18+ — nvm install 20
Flow
-
InstallInstall via: npx -y @kimsungwhee/apple-docs-mcp@latest (or add to MCP config).✓ Copied→ Tools appear
-
Ground your questionUse search_apple_docs to find 'navigationDestination' and get_platform_compatibility to check it's available on iOS 16+.✓ Copied→ Official doc entry + minimum deployment target
-
Cite in codeNow write the navigation code citing the doc you just read.✓ Copied→ Code + citations
Outcome: Code that compiles against your deployment target.
Pitfalls
- WWDC-only APIs shown before release — Check get_platform_compatibility — beta APIs are flagged