Described as a companion tool for all coding tasks, Swift Assist aims to help developers transform ideas into code and focus on higher-level problems. Powered by a model running in Apple's Cloud, Swift Assist is integrated into Xcode and can generate code from a prompt expressed in human language.
With Swift Assist, tasks like exploring new frameworks and experimenting with new ideas are just one request away. Swift Assist uses a powerful model that runs in the cloud.
For example, you can ask Swift Assist to convert a function to use async/await
, add a map with the user's current location, improve the accessibility of a view, and so on.
One advantage of running in the Cloud, says Apple, is that Swift Assist will always be up-to-date with the latest software development kits (SDKs) and Swift language features. On the other hand, the company guarantees that user code will only be used to process requests and not be stored on Apple's server nor used to train their models.
In his talk at WWDC 2024, Xcode and Swift Playground senior manager Ken Orr showed how to use Swift Assist to help create an app to catalog classic Macs starting from an empty Xcode project.
Orr's first prompt was "Create a list of classic Macs with name and description", to which Swift Assist responded by creating a ClassicMac
struct
to represent Mac models and a SwiftUI view with a pre-filled array of Macs and a List
to display them. Then he asked Swift Assist to "add images next to each Mac", which caused the existing struct
to be modified to include the image name, whereby images of Mac models were taken from the project asset catalog. Accordingly, the SwiftUI view was modified to include the image in the list. As a further example of Swift Assist flexibility, Orr asked, "Show the Macs on a grid instead of a list", which caused the code to be instantly modified to use a LazyVGrid
.
Swift Assist can help developers complete many different tasks, including localizing a view, adding login support, adding more examples to a list, and converting between different Stack types, explained Orr.
According to Orr, Swift Assist, along with Xcode predictive code completion, are just the first step to include more "intelligence" into Apple's tools, but he did not provide any additional information as to Apple's roadmap.
Apple hasn't released much detail about the model powering Swift Assist, but according to Trail of Bits' Artem Dinaburg, it should be a 70B+ parameter model specifically trained on Swift Code, SDKs, and documentation.
Swift Assist will be generally available later this year except for EU countries, says Apple, due to regulatory uncertainties related to the Digital Marketplace Act.