Sign up

Member-only story

A few tips for questions people keep asking me

Thomas Ricouard

Follow

Published in

Level Up Coding

5 min readFeb 7, 2025

If you’re not living under a rock, you might be aware that it’s possible to have a good workflow for working with an Xcode project without Xcode now. You can also improve your efficiency and throughput with an AI-assisted code editor like Cursor or VSCode with Copilot. You don’t have to wait for Swift Assist anymore!

How to use Cursor for iOS development

dimillian.medium.com

1. When I add files in Cursor they’re not added in Xcode

I have good and bad news for you. Xcode manages its own files and project structure within the .xcodeproj file. Usually, when you add a file within the Xcode UI, Xcode will create the file, but this is not sufficient. Xcode will also edit the .xcodeproj to add the file to the correct group, which will correctly link it to your target and show it in the UI.

Thankfully there are a few workarounds that:
1. You should switch to buildable folders. What are they? Wel,l basically... just folder, like any regular editor, Xcode will now simply read the folder from your drive and list and compile all the files within this folder.

I wrote about it already, there is all you need to know in this story for you to switch and use those folders.

Why you should use Xcode 16 buildable folders instead of groups

I’ve recently migrated Ice Cubes, my open-source SwiftUI Mastodon client to use file system folders instead of Xcode...

dimillian.medium.com

2. If you’re working with a legacy project or can’t switch to buildable folders, you should work with Swift Packages. Swift Package by design work just like buildable folders. Swift simply build everything in their source directory. So you have no problem and you don’t need Xcode when editing the file structure in an external editor.

2. I can’t command-click to jump to definition, and my completion is broken

I’ve been asked that a lot, and it’s probably because you missed part of the setup. One of the most important parts is to setup Xcode build server correctly. Once you have Cursor and the Sweetpad extension installed, you need to hit CMD+SHIFT+P and select “generate build server config”.

This might take a while but it’ll save and open a buildServer.json file for you.

Once this is done, you can use Sweetpad to build and run your project at least once

And now completion and cmd+click should work just fine, just like in Xcode!

3. The composer/chat is not giving me good results

This is a skill in itself. You have to learn how to ask the AI to do what you want. The gist is to give as much context as possible and as much guidance as possible. For iOS/Swift/SwiftUI projects specifically, I have to admit that the AI will always be better with a project already set up. Letting the composer set up whole parts of the project for you might not be that good. But if you’re working with an existing project, Cursor keeps an index and will use your current structure and coding style as a hint.

The tab autocomplete model is also very good at picking up what you’re doing to continue from it.

But there is another trick: rules! Cursor supports project rules, and this is guidance that Cursor will use for every prompt.

awesome-cursorrules/rules/swiftui-guidelines-cursorrules-prompt-file/.cursorrules at main ·...

📄 A curated list of awesome .cursorrules files. Contribute to PatrickJS/awesome-cursorrules development by creating an...

github.com

But mostly, it’s a skill you’ll build as you work with AI. Prompt engineering is not a bullshit skill at all.

4. How to reference code/files from third-party packages in the composer/chat

This is where the workspace (like with Xcode) enters!

With Cursor you can reference files in the chat/composer using the @. This is very useful for giving context to the prompt and asking about multiple files.

It’s easy to reference any files in your project, but what if you want to reference other files? Like the one from your third-party Swift Packages/dependencies.

Well, for that, you should reference them in your workspace.

You can use Files->Add Folder to Workspace, it’ll save a workspace for you (that you should open from now on instead of just opening your folder). And from there you can add any folder you want. It’ll not be compiled or anything but just referenced in your workspace

For example, your cloned Swift Packages dependencies are in your project-derived data SourcePackages/checkouts/

You could also add your whole derived data folder to your workspace but it might be too big and too busy for your index.

5. Xcodebuild is slow to build & launch my app

Well, this is the one I can’t do much for you. xcodebuild will always be slower than building from the Xcode UI because of the way it’s designed. But also, there is some bugs in it that make it really slower than it should be. You can read the details here:

Why is xcodebuild slower than the Xcode GUI?

There is a bug, but also it’s designed to be that way

dimillian.medium.com

I hope those tips helped you to be more efficient with Cursor and let me know if you have more questions!

Happy coding 🚀

Xcode

Swift

Cursor

AI

Programming

Responses (4)

What are your thoughts?

Also publish to my profile

Thomas Ricouard

Author

5 days ago

Thankfully there are a few workarounds that:

Let me know if you need more info

Marek Viktor

2 days ago

If you need file/folder management in VSCode while keeping your Xcode project synchronized, try to use this extension: https://marketplace.visualstudio.com/items?itemName=viktorproduction.xcode-integration

Mohammad Jeragh

Feb 9

We need some thing similar for zed. i tried my best but still having issues with metal files

More from Thomas Ricouard and Level Up Coding

Thomas Ricouard

How to use Cursor for iOS development

Oct 22, 2024

1.2K17

Some content could not be imported from the original document. View content ↗

In

Level Up Coding

by

Jimin Kang

Concurrent Programming: Producer-Consumer Problem

An overview of a couple synchronization methods to approach this central problem in concurrent programming.

2d ago

8

Some content could not be imported from the original document. View content ↗

In

Level Up Coding

by

Dr. Ashish Bamania

Multi-Head Latent Attention Is The Powerful Engine Behind DeepSeek

A deep dive Into DeepSeek’s innovative Attention mechanism that makes its LLMs so good

2d ago

48613

Thomas Ricouard

Why you should use Xcode 16 buildable folders instead of groups

I’ve recently migrated Ice Cubes, my open-source SwiftUI Mastodon client to use file system folders instead of Xcode groups.

Oct 24, 2024

5239

See all from Thomas Ricouard

See all from Level Up Coding

Recommended from Medium

In

CodeX

by

AI Rabbit

Goodbye Obsidian

Feb 6

89148

Thomas Ricouard

How to use Cursor for iOS development

Oct 22, 2024

1.2K17

Lists

General Coding Knowledge

20 stories1912 saves

Coding & Development

11 stories1007 saves

Generative AI Recommended Reading

52 stories1653 saves

What is ChatGPT?

9 stories508 saves

Michael Long

Debugging SwiftUI’s Entry Macro

The new way isn’t quite like the old way. And that was a problem.

Feb 5

1003

In

Mac O’Clock

by

Nikhil Vemu

10 cool iOS Automation ideas you’ll wish you knew sooner

You’ll be amazed to know your brick could do these!

Feb 7

63711

Some content could not be imported from the original document. View content ↗

In

Level Up Coding

by

Jayden Levitt

Warren Buffett Just Sold $133 Billion in Stock: Does He Know Something We Don’t?

It’s a stock market signal that’s becoming hard to ignore.

Feb 5

3.8K86

Some content could not be imported from the original document. View content ↗

Kevin Meneses González

How to 300x Your Productivity with These 13 AI Tools

📌 Introduction — The story of how I stopped wasting time

Feb 2

73718

See more recommendations

Help

Status

About

Careers

Press

Blog

Privacy

Terms

Text to speech

Teams