Cursor Documentation
  1. Languages & Frameworks
Cursor Documentation
  • Get Started
    • Introduction
    • Installation
    • FAQ
  • Guides
    • Editor Migration
      • Migrate from VS Code
      • Migrate from JetBrains IDEs
    • Languages & Frameworks
      • JavaScript & TypeScript
      • iOS & macOS (Swift)
      • Java
  • Editor
    • AI Commit Message
    • Notepads (Beta)
    • Keyboard Shortcuts
    • Tab
      • Overview
      • Tab vs GitHub Copilot
      • Auto-import
      • Advanced Features
    • Chat
      • Overview
      • Agent mode
      • Ask mode
      • Custom modes
      • Tools
      • Apply
    • ⌘K
      • Overview
      • Terminal Cmd K
  • Context
    • Codebase Indexing
    • Rules for AI
    • Ignore Files
    • Model Context Protocol
    • @ Symbols
      • Overview
      • @Files
      • @Folders
      • @Code
      • @Docs
      • @Git
      • @Web
      • @Definitions
      • @Link
      • @Lint Errors
      • @Lint Errors
      • @Recent Changes
      • @Cursor Rules
      • @Notepads
      • @Summarized Composers
      • #Files
      • /command
  • Account
    • Plans & Usage
    • Dashboard
    • Billing
    • Business
      • Get Started
      • Members + Roles
      • Analytics
      • SSO
  • Settings
    • Models
    • Custom API Keys
    • Early Access Program
  • Troubleshooting
    • Common Issues
    • Troubleshooting Guide
    • Getting a Request ID
  1. Languages & Frameworks

iOS & macOS (Swift)

Learn how to setup Cursor for Swift
Welcome to Swift development in Cursor! Whether you’re building iOS apps, macOS applications, or server-side Swift projects, we’ve got you covered. This guide will help you set up your Swift environment in Cursor, starting with the basics and moving on to more advanced features.

Basic Workflow#

The simplest way to use Cursor with Swift is to treat it as your primary code editor while still relying on Xcode for building and running your apps. You’ll get great features like:
Smart code completion
AI-powered coding assistance (try CMD+K on any line)
Quick access to documentation with @Docs
Syntax highlighting
Basic code navigation
When you need to build or run your app, simply switch to Xcode. This workflow is perfect for developers who want to leverage Cursor’s AI capabilities while sticking to familiar Xcode tools for debugging and deployment.

Hot Reloading#

When using Xcode workspaces or projects (instead of opening a folder directly in Xcode), Xcode can often ignore changes to your files that were made in Cursor, or outside of Xcode in general.
While you can open the folder in Xcode to resolve this, you may need to use a project for your Swift development workflow.
A great solution to this is to use Inject, a hot reloading library for Swift that allows your app to “hot reload” and update as soon as changes are made in real time. This does not suffer from the side effects of the Xcode workspace/project issue, and allows you to make changes in Cursor and have them reflected in your app immediately.

Inject - Hot Reloading for Swift#

Learn more about Inject and how to use it in your Swift projects.

Advanced Swift Development#

This section of the guide was heavily inspired by Thomas Ricouard and his article about using Cursor for iOS development. Please check his article for more details and drop him a follow for more Swift content.
If you are looking to only need one editor open at a time, and want to avoid the need to switch between Xcode and Cursor, you can use an extension like Sweetpad to integrate Cursor directly with Xcode’s underlying build system.
Sweetpad is a powerful extension that allows you to build, run and debug your Swift projects directly in Cursor, without compromising on Xcode’s features.
To get started with Sweetpad, you’ll still need to have Xcode installed on your Mac - it’s the foundation of Swift development. You can download Xcode from the Mac App Store. Once you have Xcode set up, let’s enhance your development experience in Cursor with a few essential tools.
Open your terminal and run:
Next, install the Swift Language Support extension in Cursor. This will give you syntax highlighting and basic language features right out of the box.
Then, we can install the Sweetpad extension to integrate Cursor with Xcode. Sweetpad wraps a bunch of shortcuts around the xcodebuild CLI (and much more), and allows you to scan your targets, select the destination, build, and run your app just like Xcode. On top of that, it’ll set up your project for Xcode Build Server so you get all the features mentioned above.

Sweetpad Usage#

Once Sweetpad is installed, and you have a Swift project open in Cursor, you should first run the Sweetpad: Generate Build Server Config command. This will generate a buildServer.json file in the root of your project that allows the Xcode Build Server to work with your project.
Then, from either the Command Palette or the Sweetpad sidebar, you can select the target you want to build and run.
You need to build your project once to enable auto-completion, jump to definition, and other language features.
You can also now hit F5 to build and run your project with a debugger - you might need to create a launch configuration first, but just select Sweetpad from the list when prompted!
As with many extensions in Cursor, you can bind many of the Sweetpad commands to keyboard shortcuts, to make your workflow even more efficient.
To learn more about Sweetpad, check out these resources:
Sweetpad Website
Official Sweetpad website with features and installation instructions
Sweetpad Guide
Comprehensive guide covering configuration, usage and advanced features
Modified at 2025-03-31 02:50:49
Previous
JavaScript & TypeScript
Next
Java
Built with