Exploring Cursor: Autocompletion with Tab


This chapter is taken 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 first step for working with Cursor for me was to get the keyboard shortcuts working for building and running the project on simulator and device.

Exploring Cursor: Building and Running on Simulator
Streamline iOS development with Cursor: Build, run, and hot reload without Xcode. Learn to set up Sweetpad extension, custom keyboard shortcuts, and Inject framework for instant updates. Reduce context switching by leveraging AI-powered IDE features and Claude 3.5 Sonnet for SwiftUI development.

The second step is to have overpowered autocompletion. Cursor Tab suggests changes across multiple lines which works well with SwiftUI:

It even suggests completion in third-party frameworks, and it is better than whatever Apple shipped with the predictive model. I know it is unfair to compare an on-device model, but hey, I am getting impatient waiting for Swift Assist.

From a convenience point of view, Cursor wins.

Coding should be fun, and I am glad there is an alternative to let me tab tab tab and enjoy the outcome.

Just a few characters, and you get the accurate method implementation.

Autocomplete

I mentioned about this awesome extension in the last post for easily building and running projects called as Sweetpad:

SweetPad (iOS/Swift development) - Visual Studio Marketplace
Extension for Visual Studio Code - Develop Swift/iOS projects in VS Code

I missed that it also supports autocomplete!

The installation is straightforward. You start off by installing Swift Language support from the marketplace:

Swift - Visual Studio Marketplace
Extension for Visual Studio Code - Swift Language Support for Visual Studio Code.

Then, install Xcode-Build-Server to integrate Xcode with sourcekit-lsp. Here are some installation methods:

git clone "https://github.com/SolaWing/xcode-build-server.git" && ln -s "$PWD"/xcode-build-server/xcode-build-server /usr/local/bin

Brew:

brew install xcode-build-server

Macports:

sudo port install xcode-build-server

Then, run the command SweetPad: Create Build Server Config from the command palette at the top or Shift + Command + P.

The autocomplete is not that good relative to Xcode's normal completion, but when combined with Cursor Tab, you are in for a treat!

Moving Forward

Switching IDEs is a friction in itself. And many have to deal with a bigger codebase code generation over multiple files is tricky. But I will take anything over the buggy Xcode 16.0.

Cursor was the breath of fresh air I needed in my iOS development journey. And the fact that as Cursor evolves, we will see autocompletion and code suggestions over multiple files, as mentioned in this fantastic podcast:

And more iOS devs using Cursor means more shared shortcuts, extensions, and tricks. The team definitely seems committed to making things faster and smoother.

Is Cursor going to replace Xcode entirely?

Of course not.

Another great tool in your developer toolbox. Experiment and find what works for you.

Maybe you find Xcode your purpose.

Or maybe, like me, you will find yourself reaching for Cursor more often than not, enjoying the outcome of programming than programming itself

Happy Cursoring!