How intitni/copilotforxcode works
Copilot for Xcode is a macOS Xcode source-editor extension with a background service for AI code suggestions, chat, and prompt-driven code modification. The main workflow begins with an Xcode command or editor change; the service reads editor/workspace context, dispatches to a configured provider, then presents suggestions or chat/modification results in Xcode-facing UI. The README also documents custom commands and GitHub Copilot, Codeium, and other LLM support. Several feature modules are unsampled, so their internal links are omitted or marked unverified.
Main entry points: RealtimeSuggestionController.swift Realtime suggestions · ChatService.swift Chat service · Service.swift Background service · SuggestionProvider Suggestion providers
Components 22
Xcode integration
- Xcode editor
Tool/Sources/XcodeInspector/SourceEditor.swift - Editor commands
EditorExtension - Extension XPC
ExtensionService/XPCController.swift
Service runtime
- Background service
Core/Sources/Service/Service.swift - Xcode inspector
Tool/Sources/XcodeInspector/XcodeInspector.swift - Workspace context
Tool/Sources/Workspace/Workspace.swift
AI features
- Realtime suggestions
Core/Sources/Service/RealtimeSuggestionController.swift - Suggestion providers
Tool/Sources/SuggestionProvider - Chat service
Core/Sources/ChatService/ChatService.swift - Chat context
Core/Sources/ChatService/AllContextCollector.swift - Chat plugins
Core/Sources/ChatService/ChatPluginController.swift - LLM services
Tool/Sources/OpenAIService/ChatGPTService.swift - Prompt to code
Core/Sources/PromptToCodeService/PromptToCodeServiceType.swift - Custom commands
Core/Sources/HostApp/CustomCommandSettings/CustomCommand.swift
User interface
- GUI controller
Core/Sources/Service/GUI/GraphicalUserInterfaceController.swift - Suggestion widgets
Core/Sources/SuggestionWidget/WidgetWindowsController.swift - Chat tab UI
Core/Sources/ChatGPTChatTab/ChatGPTChatTab.swift
Providers and settings
- GitHub Copilot
Tool/Sources/GitHubCopilotService/Services/GitHubCopilotSuggestionService.swift - Codeium
Tool/Sources/CodeiumService/Services/CodeiumSuggestionService.swift - Preferences
Tool/Sources/Preferences/UserDefaults.swift
Other components
- Xcode user
- Configured LLM
Connections 25
- Xcode user → Editor commands: runs commands
README.md - Editor commands → Extension XPC: sends requests
- Extension XPC → Background service: dispatches XPC
- Background service → Realtime suggestions: starts
Core/Sources/Service/Service.swift - Realtime suggestions → Xcode inspector: observes editor
Core/Sources/Service/RealtimeSuggestionController.swift - Realtime suggestions → Workspace context: updates context
Core/Sources/Service/RealtimeSuggestionController.swift - Realtime suggestions → Suggestion providers: requests completion
- Suggestion providers → GitHub Copilot: dispatches provider
- Suggestion providers → Codeium: dispatches provider
- GitHub Copilot → Configured LLM: requests suggestions
- Codeium → Configured LLM: requests suggestions
- Background service → GUI controller: starts
Core/Sources/Service/Service.swift - GUI controller → Suggestion widgets: controls panels
Core/Sources/Service/GUI/GraphicalUserInterfaceController.swift - GUI controller → Chat tab UI: builds chat tabs
Core/Sources/Service/GUI/GraphicalUserInterfaceController.swift - Xcode user → Chat service: uses chat
README.md - Chat service → Chat context: collects context
- Chat service → Chat plugins: dispatches functions
Core/Sources/ChatService/ChatPluginController.swift - Chat service → LLM services: requests completion
- LLM services → Configured LLM: sends prompts
- Xcode user → Prompt to code: requests modification
README.md - Prompt to code → LLM services: requests code
- Xcode user → Custom commands: configures commands
README.md - Custom commands → Chat service: extends chat
- Preferences → Realtime suggestions: configures feature
Core/Sources/Service/RealtimeSuggestionController.swift - Xcode editor → Xcode inspector: exposes editor state
Tool/Sources/XcodeInspector/XcodeInspector.swift