Apple just handed every iOS developer a free, private, 3-billion-parameter language model. No API key. No token bill. No data leaving the user’s phone. The Foundation Models framework—one of the headlining developer announcements from WWDC 2026—ships on iPhone 15 Pro and newer, and the barrier to entry is three lines of Swift code. If you build iOS apps and haven’t looked at this yet, now’s the time.
The Core API: LanguageModelSession
The entry point is LanguageModelSession. You create one, call respond(to:), and get generated text back. That’s the whole API surface for basic use.
import FoundationModels
let session = LanguageModelSession()
let response = try await session.respond(to: "Summarize this review: \(text)")
print(response.content)
Sessions are stateful—they retain context across turns, so multi-step conversations work naturally without you manually threading prior messages. You can also prime a session with system-level instructions at init time:
let session = LanguageModelSession {
"You are a concise editor. Flag unclear sentences and suggest fixes."
}
The developer experience here is genuinely better than any cloud AI SDK. There’s no credential management, no rate limit handling, no network error handling for the model call itself. It’s local inference with an async/await API that feels native because it is. The full API reference is available in Apple’s developer docs.
The @Generable Macro: Typed Output, No Parsing
The standout feature is guided generation via the @Generable macro. Annotate a Swift struct, tell the session to generate an instance of it, and you get back a fully typed struct. The model uses constrained token-level decoding to guarantee valid output—this isn’t prompt engineering, it’s mathematically enforced at inference time.
@Generable
struct FeedbackAnalysis {
let summary: String
@Guide(.anyOf(["positive", "negative", "neutral"]))
let sentiment: String
let actionItems: [String]
}
let session = LanguageModelSession()
let analysis = try await session.respond(
to: "Analyze this customer feedback: \(feedback)",
generating: FeedbackAnalysis.self
)
// analysis.sentiment is guaranteed to be "positive", "negative", or "neutral"
// No JSON parsing. No decode errors. No retrying because the model went off-script.
The @Guide macro lets you constrain individual fields—restrict a value to specific options, add a description to help the model understand intent, or specify numeric ranges. Behind the scenes, the framework generates a JSON schema from your Swift types and feeds it directly into the decoding process.
This solves a real problem. Anyone who’s shipped a feature on top of cloud AI has written “please return valid JSON” in a system prompt and then added a JSON parsing fallback for when it didn’t. Foundation Models eliminates that entire failure mode. The WWDC session on Foundation Models covers the internals of guided generation in detail.
What the Model Is (and Isn’t) Good For
The 3B on-device model is specialized, not general-purpose. Apple’s documentation is direct about this: don’t use it for code generation, math calculations, or factual Q&A. The model doesn’t have web access, its world knowledge is limited, and it won’t compete with GPT-5 on reasoning benchmarks.
What it is built for:
- Summarization and text compression
- Sentiment analysis and classification
- Entity extraction from unstructured text
- Smart autocomplete and suggestion generation
- Content tagging and categorization
For apps that do user-generated content moderation, smart search, journal summarization, inbox triage, or product review analysis—this is the right tool. For code assistants, research queries, or anything requiring deep reasoning, you still want a cloud model. These aren’t competing options; they serve different jobs.
Tool Calling: Giving the Model Your Data
The on-device model has no independent network access, but it can invoke your custom Swift functions through the tool calling API. This is how you connect the model to live data.
struct PriceLookupTool: Tool {
let name = "getProductPrice"
let description = "Fetch the current price for a product by ID"
@Generable struct Input { let productId: String }
func call(input: Input) async throws -> ToolOutput {
let price = await catalog.currentPrice(for: input.productId)
return ToolOutput("Current price: \$\(price)")
}
}
let session = LanguageModelSession(tools: [PriceLookupTool()])
The model decides autonomously when to call your tool based on the conversation context. You define the function; the model decides when it needs the data. Results are automatically injected back into the session context.
Privacy as a Product Feature
For health apps, finance tools, and enterprise software, Foundation Models isn’t just a convenience—it’s a compliance and trust argument. User data never leaves the device. There are no data residency concerns for the model layer, no HIPAA complications from sending patient notes to a cloud LLM, no GDPR friction from processing user text on third-party infrastructure.
Apps like Stoic (journaling) and CellWalk (medical data) have already shipped on the framework, and the privacy story is explicitly part of their user pitch. If your app handles sensitive data and you’ve been reluctant to add AI features for compliance reasons, Foundation Models is worth a serious look.
When to Reach for This vs. Cloud
Foundation Models is the right call when your task is classification, summarization, or extraction; when you care about latency (50–200ms on-device vs. 500ms+ over the network); when cost matters at scale (zero per-inference cost vs. token billing); or when user privacy is a requirement, not just a nice-to-have.
Reach for a cloud model when you need complex reasoning, code generation, factual world knowledge, large context windows, or multimodal input. The framework is text-only for now—images and audio support are on Apple’s roadmap but not yet shipped.
Device requirements are a real constraint: iPhone 15 Pro or newer, M1 iPad or Mac, with Apple Intelligence enabled. That’s not the full iOS addressable market. Build graceful fallbacks for older devices.













