GitHub Copilot for Xcode
Microsoft released an Xcode extension in a surprising turn of event
The big new thing at GitHub Universe 2024 is definitely GitHub Spark. A new AI-assisted web/app generator, it’ll allow you to generate micro apps with a simple idea. I’m registered on the waitlist for the technical preview, and I can’t wait to try it!
Note: If you want to play with those things, try Replit and Vercel V0.
GitHub also released many new features to their Copilot extension for VSCode. It seems like they’re going head-to-head with Cursor. And it’s excellent news: you can follow along with my previous article to make your iOS project build & run from VSCode / Cursor and enjoy all the new features already!
But for us iOS developers who still use Xcode (yes I still do!), the big news is in the small print.
GitHub (Microsoft) released an official extension for Xcode with a very easy setup guide to enjoy part of the VSCode copilot experience right within Xcode.
I’ve tried it a bit on some sample code, and it’s better than Xcode's new (local) predictive model. It’s faster, more accurate, and can generate more lines of code.
The code above is just a sample project; it seems to work fine in that context. I’ve tried it within the Ice Cubes project and need to use it more to give my honest opinion. Generating a sample structure, sample data from it, and a view that displays those data was a breeze.
It can generate one line at a time, and if it’s about to generate more than one, you can press the option key to see what it’ll generate next as you press tab.
It seems to fall slightly short of the Copilot extension within VSCode and Cursor tab. I guess that it doesn’t index and embed your entire project, only the current file.
But it seems that there is a learning curve too. I’ve coded a new feature with it for a while and got better suggestions. I was able to tab tab tab the addition of my new feature in the various places of the existing code. And it was added in a separate file.
Here is another demo of some boring UIKit constraints
GitHub Copilot and Cursor Tab can generate code with the correct context (so not only SwiftUI primitives) that compiles most of the time. Xcode predictive models and the GitHub copilot extension for Xcode are a bit more hit-and-miss for now.
Overall, this is an awesome first step! It’s also open source, so anyone can submit improvements. I plan to dig into it over the next few days.
A funny / not-so-funny note from their readme is to disable Xcode 16 new predictive code completion feature so it does not conflict with Copilot suggestion.
And I would say from what I’ve tested, they’re right; GitHub Copilot is consistently better. To Apple’s defense, the whole thing runs locally with the model embedded on your Mac.
I can’t wait to hear your opinion about this. Did you install the extension? How does it compare to Apple's built-in predictive model in your projects?
Let me know!