This chapter is an excerpt from my book, "AI Assisted Coding for iOS Development". You can buy it to learn further about Cursor:

Exploring AI Assisted Coding
Cursor, Copilot, Windsurf, Alex for iOS Development

The hype got me. The FOMO when half of my X feed is filled with developers praising Cursor, and the other half wanting to try it out.

As an individual developer, what can I do to reduce the friction of coding and ship faster with the new AI editor? That is the topic of this post.

The Problem: Context Switching

Before diving into Cursor, this is my current workflow, which I think many developers are using:

  • I use Xcode to build apps, and when I need some assistance, I use Claude 3.5 Sonnet, which I absolutely love.
  • This creates a constant context-switching problem:
    • I copy some code from Xcode.
    • Switch to Claude 3.5 Sonnet and paste the code.
    • Ask for help or suggestions.
    • Claude gives me output.
    • I figure out which code to copy.
    • Switch back to Xcode, and make the changes.
    • When I am learning something new, I type out the code instead.
    • Build and test again.

This workflow, while functional, has some friction that hopefully can be reduced using Cursor.

Also, I have a relatively slow MacBook (M1 Pro is now old, okay?), which makes Xcode previews forever to load. To work around this, I use a package called Inject, which provides hot reload functionality in simulators.

This helps to see changes in real-time without waiting. For those interested in a similar setup, you can find the documentation on how to get started with Injection for your Xcode projects.

Using Cursor with Simulator

Using Inject means I can make changes in the code, save the file, and it would reload on the simulator, without context-switching to Xcode. There are some times where it may not work well, and in that case I can build the projec again from Xcode, and try again.

Additionally, using my knowledge from the CI/CD days, I found a quick workaround for build issues:

  • Open the terminal quickly in Cursor by pressing Function + Control + `.
  • Use the following alias to run your project:
alias build_meshing='xcrun xcodebuild \
-scheme Meshing \
-project Meshing.xcodeproj \
-configuration Debug \
-destination "platform=iOS Simulator,name=iPhone 15,OS=18.0" \
-derivedDataPath build'
  • Replace "Meshing" with your project name (both in the scheme and project file name)
  • Update the simulator name and OS version

Using Cursor without Xcode

If you hate Xcode, and want to run simulator from Cursor directly, I think you can do that too.

Create an alias that handles building your project, launching the simulator, and running your app. Here is an example:

alias run_meshing='xcrun xcodebuild \
-scheme Meshing \
-project Meshing.xcodeproj \
-configuration Debug \
-destination "platform=iOS Simulator,name=iPhone 15,OS=18.0" \
-derivedDataPath build \
&& (xcrun simctl boot "iPhone 15" || true) \
&& open -a "Simulator" \
&& xcrun simctl install booted build/Build/Products/Debug-iphonesimulator/Meshing.app \
&& xcrun simctl launch booted com.rudrankriyam.meshing'

This alias builds your project using xcodebuild, boots up the specified simulator, (in this case, iPhone 15 with iOS 18.0) opens the Simulator application, installs your built app onto the booted simulator and launches your app on the simulator!

To use this setup:

  • Replace "Meshing" with your project name (in the scheme, project file name, and app name)
  • Update the simulator name and OS version as needed
  • Change the bundle identifier (com.rudrankriyam.meshing) to match your app's identifier
  • Add this alias to your shell configuration file (e.g., .zshrc or .bash_profile).

While it is still a hassle, you can simply type run_meshing (or whatever you named your alias) in the Cursor terminal to build and run your app in the simulator, all without opening Xcode!

I am still exploring working with Cursor, and will update this post, so bookmark it!

Happy shipping!

String Catalog

String Catalog - App Localization on Autopilot

Push to GitHub, and we'll automatically localize your app for 40+ languages, saving you hours of manual work.

Tagged in: