Copilot is now available in Xcode (and it’s good!)
You’re more of a video kind of person? I’ve got you covered! Here’s a video with the same content than this article 🍿
Advertisement
Sponsors like Git Tower really help me grow my content creation, so if you have time please make sure to check out their survey: it’s a direct support to my content creation ☺️
I’m sure that you’ve heard of Copilot at least once: it’s one of the earliest and most popular AI coding assistant on the market.
It’s been possible for a long time to use Copilot with Swift and iOS, but it required to either write code in VSCode and switch back to Xcode to build your project, or to use unofficial Xcode extensions.
But that has changed a couple of weeks ago, when GitHub released an official Xcode extension for Copilot:
I gave this extension a try during a livestream and I must say that I’ve been impressed by how smooth it was to use it!
The extension is very responsive and code predictions show up much faster than when using Xcode’s new built-in Predictive Code Completion.
Copilot is also able to predict several lines of code at once, something that Xcode’s tool struggles to do well for now:
However be careful: predictions can still be hit-or-miss.
For example, during my livestream I had been quite happy to see Copilot suggesting to use the modern Swift Concurrency API to implement a network call:
But when I tried it again while writing this email, I was disappointed to see that this time Copilot was suggesting to use the now deprecated completionHandler
pattern:
It gets even worse when you want to use very recent APIs or frameworks, for which there’s low (or even zero) examples for Copilot to train on.
Typically, if you ask it to help your write tests using the new Swift Testing framework, it will hallucinate method calls that do not exist:
So please, remember to take the predictions with a grain of salt and don’t hesitate to rewrite part of the generated code in order to skew Copilot in the right direction.
Conclusion
Overall I must say that even though the tool does have its limits, I’ve been quite happy using this integration of Copilot into Xcode!
It runs smoothly, makes relevant enough suggestions and doesn’t break your flow by asking you to wait for too long.
I would really recommend that you give it a try, because there’s a very high probability that it will give you a noticeable boost in productivity!
And if you want to see it in action without having to install anything, feel free to watch the replay of my livestream: