
What happened
A tutorial shows how importing Foundation Models framework, creating a LanguageModelSession with instructions, and calling try await session.respond(to:) adds AI text generation to a Swift app.
Why it matters
Developers can offer text generation inside an app without separately preparing an external AI service, since the model runs on the device and the sample uses a few lines of Swift code.
Ask the AI about this article. Questions and answers are published on this page
The tutorial is the first in a series aimed at readers who already know basic SwiftUI, and it lays out three ways to use Apple Intelligence from Swift: Foundation Models for text generation and reasoning, App Intents for letting Siri and other OS features operate an app, and Image Playground for image generation. The sample code focuses on the first and third because they are easier to demonstrate. For text generation, the flow is to import Foundation Models, create a LanguageModelSession with instructions that describe how the AI should respond, and then call respond(to:) with a prompt; the answer arrives in response.content. The tutorial notes that respond(to:) is asynchronous and can fail, so it is called with try await and errors are caught.
The image sample instead calls the system-provided generation screen via the imagePlaygroundSheet modifier, passing a concept string such as "a cat flying in space." It also checks supportsImagePlayground from the environment to decide whether the device supports the feature. The tutorial advises running samples on a real device, since simulator capabilities and execution conditions may differ. It distinguishes this on-device approach from conventional generative AI services that send input over the internet to an external server, noting benefits for privacy and for use in poor network conditions, while cautioning that not all Apple Intelligence processing is completed on the device.
Pick your industry and the AI tools you use, and get news related to your work every day.
By signing up you agree to the Terms of Service and Privacy Policy.
Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →
ArtFanders and Spice Factory signed a partnership on planning and deploying AI agents, and Spice Factory is la…

Uneri and Pineal will hold a free, in-person event in Tokyo on December 18, 2026, where Pineal CTO Ken Fujita…

Google said support for Gemini 4 Argon, which launched in general availability on October 13, ends after Decem…

AWS introduced an agentic experience for its Migration Acceleration Program within AWS Transform and a forward…

Salesforce and OpenAI began offering an expanded beta of their ChatGPT plugin, adding Marketing Cloud and Reve…

The pipeline trained MiniCPM5-1B on 300 validated patches, then packed the SFT model into a 2GiB .r1m file (2…
