AI features in Xcode 16: is it 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 🍿
Last week I did a livestream to explore and discover what was one of the WWDC announcements that had me the most excited: the introduction of a CoPilot-like AI coding assistant in Xcode 16 🤖
When Apple announced this feature, they put the bar quite high by promising a very strong level of quality:
“we've created specialized coding models that capture expertise only Apple can provide, like the latest APIs, language features, […] and best practices distilled from decades of building software for all our platforms”
So naturally, I was really curious to try it for myself and see whether the product lives up to these high standards 🕵🏻♂️
But before I start sharing my feedback, one important disclaimer: I’ve tested the Predictive Code Completion feature using Xcode 16 beta 1.
So please keep in mind that there’s a chance the drawbacks I’ll mention will be fixed by the time of the official release in September.
Here’s what I’ve liked 👍
First, let’s talk about what I’ve found positive with this new feature!
Like Apple claimed during the Platform State of the Union, predictive code completion is quite good at writing dull boilerplate code for you.
For instance, if you first declare the properties of a SwiftUI view, than it will be able to suggest a basic implementation for its body:
Same thing if you implement a struct to hold your data model and then want to create mocked values to populate your previews:
Another great feature is that you can use comments in order to give hints to the AI for what you’d like to implement:
As you can see it’s not perfect, it added a test using a property that doesn’t exist in my code, but removing this extra code would be easy.
Finally, when you want to implement something that’s similar to an existing piece of code, the AI is quite good at understanding what to keep and what to change:
(but be careful: this isn’t an excuse to start duplicating code!)
Here’s what I’ve disliked 👎
Now let’s talk about what got me a bit disappointed, and unfortunately there are quite a few items.
First, there’s no visual cue in Xcode that the AI is working on a prediction. So you just have to wait for a few seconds and see if something happens.
This really isn’t great because it forces you to stay idle with no guarantee that what you’re waiting for will eventually happen.
I really hope that Apple will be able to fix that in the final release, because I can imagine this becoming quite frustrating in the long run.
Another smaller disappointment is that, unlike CoPilot, the AI will only produce one prediction and there’s no way to ask for another one if you’re not happy with it.
But unfortunately there are also much bigger issues than these small ergonomic quirks…
Remember how Apple said that the UI had been trained on “the latest APIs and language features”?
I wanted to put it to the test by having the AI write a test for me using the new Swift Testing framework:
As you can see, the AI didn’t really deliver on its promise because it suggested using assertions with the syntax of XCTest, Apple’s previous testing framework.
Granted, Swift Testing is a brand new framework and so it’s understandable that the version of the AI that ships with the very first beta of Xcode isn’t familiar with it.
However, even with a language feature like async
/ await
, which has been part of Swift for 4 years, the AI still seems to have a preference for our good old completion handlers:
Now that’s a real problem!
Because it’s easy to imagine how such an outdated prediction can have a negative impact on a junior developer that doesn’t have the experience to understand that what’s being suggested is a bad approach.
So I really really hope that Apple will improve on this particular aspect, because it would be quite sad to see this shiny new Xcode feature actually ending up having a harmful effect 🥲
That’s it: this was the recap of how I felt after having experimented with Predictive Code Completion in Xcode 16!
My current feeling is that while there’s definitely potential, the ergonomics are not as good as CoPilot and some of the predictions really don’t live up to their promise of “providing best practices”.
I’m still hopeful that the feature will improve over the summer and I’ll be on the look out to let you know if I see any significant changes 🫡
And if you’re curious to see the feature in action, you can watch the replay of the livestream 🍿