AI-powered coding assistant for Xcode, powered by Sourcegraph Cody.
Xcody brings real-time code suggestions, AI chat, and prompt-based code commands to the Xcode IDE, making Swift development faster, smarter, and more intuitive.
π§ Xcody is under active development.
- π§ AI Code Completions β Powered by Sourcegraph Cody
- π¬ In-Editor Chat β Ask questions about your code without leaving Xcode
- β‘ Prompt Commands β Generate docs, explain code, or run custom tasks on selected text
- π οΈ Native Integration β Built using Swift + XcodeKit for a seamless IDE experience
π Note: Xcody requires access to a Cody-compatible API. This typically requires an enterprise contract with Sourcegraph.
- Xcode 15+
- macOS 13+
- A running Sourcegraph Cody backend with OpenAI-compatible API
- A valid Cody API key
- Download the latest release or export from code
- Drag Xcody to your Applications folder
- Launch Xcody and follow the setup instructions
- Folder Access
- Accessibility API
If you are concerned about key logging and cannot trust the binary, we recommend examining the code and building it yourself. To address any concerns, you can specifically search for
CGEvent.tapCreate
,AXObserver
,AX___
within the code.
Install it manually, by downloading the Xcody.app
from the latest release.
Unzip and move the app to the Applications folder BEFORE running it.
Open the app, the app will create a launch agent to setup a background running Service that does the real job.
The first time the app is open and command run, the extension will ask for the Accessibility permission.
Alternatively, you may manually grant the required permissions by navigating to the Privacy & Security
tab in the System Settings.app
.
- To grant permissions for the Accessibility API, click
Accessibility
, and dragXcodyExtensionService.app
to the list. You can locate the extension app by clickingReveal Extension App in Finder
in the host app.
If you encounter an alert requesting permission that you have previously granted, please remove the permission from the list and add it again to re-grant the necessary permissions.
You may also need to give permissions for Allow in Background
and Xcode Source Editor
. Check these under Settings
> General
> Login Items & Extensions
, under Allow in Background
and Extensions
> Xcode Source Editor
respectively. You can use the Extensions Settings
button in the Xcody app to open Settings.
- Go to Service > Chat Models > Add Model. Fill a custom name and select a Model Name from the dropdown. Then input your Cody API Key. Select the API Key you input. Tap Test button to validate integration.
- Go to Service > Cody > Cody Language Server and tap Install.
- Go to Features > Suggestion and check Real-time suggestion
- Feel free to explore XCody's settings
- You can now boot Xcode and use the extension.
The extension will work better if you use key bindings.
It looks like there is no way to add default key bindings to commands, but you can set them up in Xcode settings > Key Bindings
. You can filter the list by typing Xcody
in the search bar.
A recommended setup that should cause no conflict is
Command | Key Binding |
---|---|
Accept Suggestions | β₯} or Tab |
Dismiss Suggestions | Esc |
Reject Suggestion | β₯{ |
Next Suggestion | β₯> |
Previous Suggestion | β₯< |
Open Chat | β₯" |
Explain Selection | β₯| |
Essentially using β₯β§
as the "access" key combination for all bindings.
Another convenient method to access commands is by using the β§β/
shortcut to search for a command in the menu bar.
Currently, there is only one global hotkey you can set to show/hide the widgets under the General tab from the host app.
When this hotkey is not set to enabled globally, it will only work when the service app or Xcode is active.
- Get admin privileges (e.g., sudo or Privileges app)
- Delete Xcody.app from the Applications folder;
- Remove XcodyExtensionService.app from Accessibility settings;
- Run
sfltool resetbtm
in Terminal; - Reboot.
Files in gitignore will not receive suggestion. Both chat and prompt to code feature will not have access to them unless you manually select code from them.
The chat knows the following information:
- The selected code in the active editor.
- The relative path of the file.
- The error and warning labels in the active editor.
- The text cursor location.
- Open Chat: Open a chat tab.
Shortcut | Description |
---|---|
βW |
Close the chat tab. |
βM |
Minimize the chat, you can bring it back with any chat commands or by clicking the circular widget. |
β§β©οΈ |
Add new line. |
β§β] |
Move to next tab |
β§β[ |
Move to previous tab |
Refactor existing code or write new code using natural language.
This feature is recommended when you need to update a specific piece of code. Some example use cases include:
- Improving the code's readability.
- Correcting bugs in the code.
- Adding documentation to the code.
- Breaking a large function into smaller functions.
- Generating code with a specific template through custom commands.
- Polishing and correcting grammar and spelling errors in the documentation.
- Translating a localizable strings file.
- Write or Modify Code: Open a modification window, where you can use natural language to write or edit selected code.
- Accept Modification: Accept the result of modification.
You can create custom commands that run Chat and Modification with personalized prompts. These commands are easily accessible from both the Xcode menu bar and the context menu of the circular widget. There are 3 types of custom commands:
- Modification: Run Modification with the selected code, and update or write the code using the given prompt, if provided. You can provide additional information through the extra system prompt field.
- Send Message: Open the chat window and immediately send a message, if provided. You can provide more information through the extra system prompt field.
- Custom Chat: Open the chat window and immediately send a message, if provided. You can overwrite the entire system prompt through the system prompt field.
- Single Round Dialog: Send a message to a temporary chat. Useful when you want to run a terminal command with
/run
.
You can use the following template arguments in custom commands:
Argument | Description |
---|---|
{{selected_code}} |
The currently selected code in the editor. |
{{active_editor_language}} |
The programming language of the active editor. |
{{active_editor_file_url}} |
The URL of the active file in the editor. |
{{active_editor_file_name}} |
The name of the active file in the editor. |
{{clipboard}} |
The content in clipboard. |
Our long-term vision is for Xcody to become a fully agentic assistant for Xcodeβable to intelligently and autonomously assist with software development under your guidance.
Read more in VISION.md.
We welcome contributions from the community!
- Read our DEVELOPMENT.md.
- Read our CONTRIBUTING.md.
- Follow the CODE_OF_CONDUCT.md.
- Security issues? See SECURITY.md.
Xcody currently does not support:
- Remote codebase indexing
- Chat history or persistent memory
- Saving custom prompts to the cloud
- Public API use (enterprise Cody backend required)
See our current plans in VISION.md. Major upcoming features:
- π§ Replace custom chat with Cody Agent
- π§ Support multi-step autonomous workflows
- βοΈ Add prompt workflow editor
- π Deep integrations with Instruments, Simulator, etc.
Xcody is released under the MIT License.
- Xcody is a fork of Copilot for Xcode. We are thankful to the source project for enabling us to hit the ground running.
- This software was originally developed at Booking.com. With approval from Booking.com, this software was released as open source, for which the authors would like to express their gratitude.
- The Swift logo is a trademark of Apple Inc.
Built with β€οΈ by developers who want Cody in Xcode.