Skip to content
  • Blog

Swift 6 and Apple Intelligence: How Apple's new initiatives will benefit developers

July 3 — 2024

In a world where each new advancement seems to redefine the limits of what's possible, Apple has managed to remain both innovative and discreet. This year at WWDC, with the launch of Swift 6 and the introduction of Apple Intelligence, Apple once again asserts its dominance in the programming world and takes its first significant step into artificial intelligence.



How can developers leverage Apple Intelligence?

AI is everywhere in the news. Everybody has its AI-thing. But one company that stayed silent on the subject is Apple. Sort of.

As a matter of fact, Apple just stayed quiet on what it was doing. It has a whole blog on machine learning research, but the one that came to mind is the introduction of OpenELM back in April promising efficient language models. And what Apple unveiled during WWDC just confirmed the future of AI in its ecosystem: Apple Intelligence (get it?). We won't spoil what it is, you can read our previous article on the subject.

So, what can we do as developers with Apple Intelligence? 

Let’s preface this by saying that machine learning is at the core of a lot of features without us knowing it. And what Apple gives us is access to those frameworks and tools to enhance the functionality of our apps. It's also a statement to not call it Artificial Intelligence, because it's not: what we know as AI is essentially machine learning. Advances and highly specialized models trained to perform tasks. Now, it's locally on any of our fruity devices.



1. Writing Tools and Image Playground

To leverage the OS's generative AI capabilities.

The first steps into Apple Intelligence for your app would probably be two new system-level features: Writing Tools and Image Playground. Writing Tools will offer language tools to any standard text input to assist during writing. For Image Playground, generating an image for a profile image as an example will be easy, though it might take some development to allow users to generate images directly from an app. Those are the easiest way to tap into Apple Intelligence.

2. App Intents

To give more context about your application and its business logic.

But what if we want more? If an app is already using App Intents, then it's a drop-in support. It gives Siri the capabilities to use the app and perform actions for the user. Frameworks are already available for computing like natural language, speech-to-text, and sound analysis, and Vision framework. Vision covers visual intelligence, including text extraction, face detection, body pose recognition and now hand pose detection in body pose requests and aesthetic score requests. The new addition this year is a new framework for language translation, letting us do language to language translation easily.


3. CreateML

To train and execute your own model locally on compatible Apple devices.

Still not enough? What if you are a machine learning expert? CreateML can help to customize each Apple framework by training a model with more relevant data. But wait there's more: you can run your own model that is tailored specifically for your needs like Stable Diffusion, Mistral or OpenELM. Using Core ML tools, training libraries like PyTorch, a Core ML model can be efficiently trained, created and converted to be directly integrated. It allows to run models with hardware acceleration and completely locally.


As we delve into the possibilities provided by Apple Intelligence, we also witness the ongoing evolution of the software developer’s role. Our curiosity and willingness to embrace innovation are crucial for helping us work more intelligently. The last two years have brought numerous advancements, both in integrating AI into the products we develop and in refining our work methods. With Swift, Apple continues to support us in this journey, offering new opportunities to improve both the products we create and our ways of working.



Swift's Tenth Anniversary

Swift, Apple's programming language, is celebrating its 10th anniversary! Over the past decade, Swift has shown its versatility, expanding from mobile app development to a wide range of areas, including frameworks, firmware, network services, kernels, and embedded systems.

Today, Swift is available on various Linux and Windows distributions, once again creating new opportunities for developers. This expansion has required a significant effort, particularly with a single implementation of Foundation, rewritten in Swift, now being used across all supported platforms. Apple asserts that adopting Swift enhances the quality of its software and continues to integrate it into its products, thanks to its interoperability with C, C++, and Objective-C, facilitating a smooth transition and gradual adoption.


Swift 6 Release

Swift 6 is set to launch later this year, marking a significant milestone in the language's evolution. The standout feature of this version is "data-race safety," allowing the Swift compiler to identify data race conditions and handle them as compile-time errors. This significant advancement enhances the safety of concurrent programs, a top priority for developers working on parallel and distributed systems.

Race conditions are a common programming error in concurrent systems. These errors are often subtle, challenging to reproduce, and can result in unexpected behavior or, worse, crashes. The Swift compiler can now help identify these errors and guide us in fixing them. This feature is another example of how Swift leverages its compiler to ensure program safety.

Given the significant impact this feature will have on existing code, data-race error detection is provided through a specific "Language Mode" that developers must opt into. This feature is not enabled by default, facilitating incremental adoption by activating this mode one module at a time. Fortunately, using Swift 6 does not mandate this mode; the compiler and other new language features will be accessible to everyone, regardless of the chosen "Language Mode."

Swift 6 introduces new features designed to enhance team productivity and improve code readability.

Growth of the Swift ecosystem

The Swift ecosystem is flourishing, thanks to the contributions of both Apple and its open-source community. This growth not only fosters collaboration within the development community but also offers valuable insights into how Apple develops some of its core technologies.

As a result, Swift is expanding and moving to its own GitHub organization. This new, Apple-independent space dedicated to Swift will host crucial projects within the ecosystem, such as the Swift compiler, Foundation, and other key libraries. This migration heralds a new era for Swift, paving the way for a more versatile and accessible language.

“ This migration reflects the growth and maturity of the Swift community and highlights Swift’s versatility beyond Apple’s own ecosystems. Over the last decade, many inspiring individuals’ hard and creative work has elevated Swift into various creative and practical applications. With a GitHub organization dedicated to Swift, we are creating an even more conducive environment for collaboration and innovation. This change will allow Swift to expand its reach to more platforms and use cases, sparking fresh possibilities and broadening Swift’s impact across the technology landscape.”

⏤ Ted Kremenek, Director, Languages and Runtimes at Apple and member of the Swift Core Team.

With Swift 6 and Apple Intelligence, Apple is unveiling new features designed to enhance the development experience and ecosystem. These innovations provide developers with new opportunities to create more secure applications and seamlessly integrate artificial intelligence.

00:00
00:00

En français SVP !