Apple Intelligence in your own apps: the Foundation Models framework

Since iOS 26, apps can use Apple's language model right on the device, free and private. Here's how it works in Swift.

2 min readby Luca Ring

Two hands holding an unfolded iPhone with a product page and Hour's work time below the price
Hour uses the on-device model when a price is ambiguous.

AI in an app used to mean sending data to a server, paying per request and hoping the connection holds. With iOS 26, Apple gave developers access to the language model that also powers Apple Intelligence. It runs right on the device, costs nothing per request and works offline.

The first lines

The framework is called Foundation Models. One session, one prompt, one answer:

import FoundationModels

let session = LanguageModelSession(
    instructions: "Summarise journal entries in one sentence."
)
let answer = try await session.respond(to: entry.text)
print(answer.content)

Check first whether the model is available. Not every device supports Apple Intelligence, and users can turn it off. SystemLanguageModel.default.availability tells you why, so your app can respond gracefully.

Structured answers instead of text

The real strength is guided generation. You describe a Swift type with @Generable, and the model returns exactly that type instead of free text you'd have to pick apart:

@Generable
struct PriceChoice {
    @Guide(description: "The actual purchase price")
    var price: Double
    @Guide(description: "Is it a subscription price?")
    var isSubscription: Bool
}

let result = try await session.respond(to: pageText, generating: PriceChoice.self)

An example from my apps

In Hour I use exactly this idea. Hour looks for the real purchase price on product pages. Fixed rules usually do the job. But when a price is ambiguous, the language model helps pick the right one on devices with Apple Intelligence, entirely on the device. In RingoView, an assistant answers questions about your own App Store numbers, again without data leaving the device.

Two hands holding an unfolded iPhone with a product page and Hour's work time below the price
Hour uses the on-device model when a price is ambiguous.

What it's good for, and what not

  • Good: summarising, classifying text, extracting data from text, short suggestions, answers about data already in your app.
  • Less good: world knowledge and current facts. The model is deliberately small and doesn't know everything.
  • Your own tools: through the Tool protocol, the model can call functions in your app, for example to search entries.

Why it's so good for privacy

Because everything happens on the device, you need no server of your own, no privacy gymnastics for third parties and no API costs. For indie developers that's a real game changer. More on apps without accounts and tracking in Apps without an account.

  • Foundation Models
  • Apple Intelligence
  • on-device AI
  • Swift
  • iOS 26