85 lines
2.5 KiB
Markdown
85 lines
2.5 KiB
Markdown
# iOS AI Setup
|
|
|
|
## Setup Path A: Xcode + GitHub Copilot for Xcode
|
|
### Prerequisites
|
|
- Xcode installed and up to date.
|
|
- GitHub account with Copilot Enterprise access.
|
|
|
|
### Install and Sign In (High-Level)
|
|
1. Install the GitHub Copilot for Xcode plugin.
|
|
2. Sign in with your GitHub account.
|
|
3. Confirm Copilot is enabled in Xcode.
|
|
4. Run a simple prompt to verify suggestions appear.
|
|
|
|
### Example Prompt (Xcode)
|
|
Type this in a Swift file comment, then wait for a suggestion:
|
|
|
|
Example prompt:
|
|
```text
|
|
// Create a function that validates an email string.
|
|
```
|
|
|
|
### Verification Steps
|
|
- Open a Swift file and start a small function.
|
|
- Confirm inline suggestions appear.
|
|
- Open the Copilot chat panel and ask a short question.
|
|
|
|
## Setup Path B: VS Code + GitHub Copilot Extension
|
|
### When to Use VS Code on iOS
|
|
- Editing shared docs or configs.
|
|
- Rapid refactors or explorations.
|
|
- Working on multi-platform files.
|
|
|
|
### Install and Sign In (High-Level)
|
|
1. Install VS Code and the GitHub Copilot extension.
|
|
2. Sign in with your GitHub account.
|
|
3. Confirm Copilot is enabled in VS Code.
|
|
4. Run a simple prompt to verify suggestions appear.
|
|
|
|
### Example Prompt (VS Code)
|
|
Open a Swift file and add:
|
|
|
|
Example prompt:
|
|
```text
|
|
// Create a Swift struct for a user profile with name and email.
|
|
```
|
|
|
|
### Verification Steps
|
|
- Open a Swift file and type a short function signature.
|
|
- Confirm inline suggestions appear.
|
|
- Open Copilot Chat and request a short summary.
|
|
|
|
## iOS-Specific Guidance
|
|
- Ask for Swift/SwiftUI patterns with small, bounded tasks.
|
|
- Request tests or sample usages for view models.
|
|
- Favor refactor or patch requests over full rewrites.
|
|
|
|
### Example Request
|
|
Example prompt:
|
|
```text
|
|
Refactor this SwiftUI view to reduce duplication. Do not change behavior. Provide a short diff summary.
|
|
```
|
|
|
|
### Starter Prompts
|
|
Example prompts:
|
|
```text
|
|
Create a SwiftUI view model for this screen and list its inputs and outputs.
|
|
Write unit tests for this view model using XCTest.
|
|
Refactor this view to reduce duplication without changing behavior.
|
|
```
|
|
|
|
## MCP For iOS
|
|
The detailed MCP setup and XcodeBuildMCP guidance is in a dedicated page:
|
|
|
|
- [XcodeBuildMCP (iOS)](ios-xcodebuildmcp.md)
|
|
|
|
## iOS Troubleshooting
|
|
- If suggestions are missing, confirm sign-in and access.
|
|
- If the plugin is not visible, verify extension compatibility.
|
|
- If responses are blocked, check network or policy constraints.
|
|
|
|
### Common Setup Gaps
|
|
- Copilot access not provisioned for the GitHub account.
|
|
- Xcode plugin disabled after update.
|
|
- Multiple AI plugins competing for suggestions.
|