IPhone company releases first AI code generation model 'Swift Assist'

The iPhone company announced several major updates for developers at the Worldwide Developers Conference (WWDC 2024). In this series of updates, Swift Assist is a new code assistant tool that can understand the latest software development kits (SDKs) and Swift language features, ensuring that developers can always leverage the latest code features and seamlessly integrate them into their projects.

Swift Assist "aims to help developers translate their ideas into code and focus on solving higher-level problems. Swift Assist is supported by models running on Apple Cloud Services, can be integrated into Xcode, and can generate code based on prompts expressed in human language.

Using Swift Assist, tasks such as exploring new frameworks and trying out new ideas can be easily completed with just one request. Swift Assist relies on powerful cloud models to provide services.

For example, you can request Swift Assist to modify the function to use asynchronous/await, add a map that displays the user's current location, and improve the accessibility of the view.

Apple pointed out that one advantage of deploying Swift Assist in the cloud is that it can always keep up with the latest software development kits (SDKs) and Swift language features. At the same time, the company promises that user code will only be used to process requests and will not be stored on Apple's servers or used to train its models.

At the 2024 Worldwide Developers Conference (WWDC), Ken Orr, Senior Manager of Xcode and Swift Playground, demonstrated how to use Swift Assist to create an application that documents classic Mac computers from a blank Xcode project.

Orr's first input prompt is "Create a Classic Mac list containing names and descriptions", and Swift Assist then creates a Classic Mac structure representing Mac models, a SwiftUI view pre filled with Mac arrays, and a List to display them. Subsequently, he requested Swift Assist to 'add images next to each Mac', which resulted in the original structure being modified to include image names, which were then retrieved from the project's asset directory.

In addition, the SwiftUI view has been modified to display images in the list. As another example of Swift Assist flexibility, Orr requires Mac to be displayed in a grid rather than a list, which resulted in the code being immediately modified to use LazyVGrid.

Swift Assist can assist developers in completing various tasks, such as localizing views, adding login support, adding more examples to lists, and converting between different Stack types, "Orr added.

According to Orr, the predictive code completion feature of Swift Assist and Xcode is only a preliminary attempt to introduce more "intelligence" into iPhone tools, but he did not disclose any detailed information about the future development roadmap of iPhone.

Although the iPhone has not yet revealed the specific model details driving Swift Assist, according to Artem Dinaburg from Trail of Bits, the model should be a model with over 7 billion parameters specifically trained for Swift code, SDK, and related documentation.

The iPhone company stated that due to regulatory uncertainty related to the Digital Markets Act, Swift Assist is expected to be launched in regions other than EU countries later this year.