How to use Cursor to build Swift code (or along with Xcode)

I’m playing with Cursor for the first time (so far awesome!). My intent is to write Swift to build an app on macOS. At this moment, I still rely on the build function in Xcode, so I have both editors open and use Cursor only for chatting on top of the code base. However, I am afraid to hit “apply suggestions” and save.

  1. Can I somehow build my Swift app without Xcode, ideally in Cursor?
  2. If not, is it safe to save in one editor (Cursor) and continue in another (Xcode)? I use Git for versioning as well, so I don’t want to mess it up.

Thanks a bunch!

4 Likes

I came here wondering the same, and you have the only thread with no replies. My findings are still no, you are going to be copying from Cursor and pasting into Xcode. It works fine for smaller projects but would be awesome to have some easier way to integrate.

For those wondering I have found Apple’s GenAI for Xcode to be useless so far.

I came here wondering the same thing, but I haven’t found a way yet.

I’ve tried a few things and found some answers to my questions:

  1. Yes, you can build via a terminal command:

cd path/to/your/ProjectName

xcodebuild -project MyApp.xcodeproj -scheme MyApp -configuration Debug

However, I’m wondering if there’s a way or a plugin to avoid using the terminal?

  1. Yes, it seems safe—the changes are promoted instantly. I still prefer to save in Xcode, though.

Note: Check out the extension marketplace in Cursor—I just discovered that you can get plugins like sswg.swift-lang (Swift Language Support), etc.

Also wondering the same.

Same concern here! Any one successfully build iOS app on Cursor?

I came here for same reasons. Do we have any planned features for Xcode ?

1 Like

Building with Cursor / VSCode is possible but the setup is a bit tricky.

But using Cursor & VSCode concurrently actually works really well.
Here is my work flow:

  1. Create a project in Xcode
  2. Open it in Cursor
  3. Index it in Cursor (top right corner there is a gears button and you can find indexing there)
  4. Do your edits in Cursor leveraging Cursor Compose or chat. Apply / save changes.
  5. Refresh Xcode and the changes will be picked up.

The key points to remember are: (a) make sure the code is indexed in Cursor and (b) refresh both Cursor and Xcode as needed to make sure files are in sync.

Here is a tutorial on how to build straight from Xcode and even hot reload: Exploring Indie Life: Reducing Friction with Cursor

Thanks for the mention of my blogpost @drstarson. I have created a separated tag and wrote a few more posts working with Cursor:

https://www.rudrank.com/tag/cursor/

I will continue documenting my experiments so we can make the most out of Cursor as an iOS developer!

1 Like

This hot reloading tool might be helpful too. It allows you to build via terminal directly to the simulator in cursor. GitHub - krzysztofzablocki/Inject: Hot Reloading for Swift applications!

This video could be interesting.

1 Like

Indeed! A lot of golden nuggests in that video that I plan to write it down!