Claude in the Foundation Models Framework: The Handoff Becomes a Pattern
Anthropic released a Swift package that connects Apple’s Foundation Models framework to Claude. Available starting today, on iOS 27, iPadOS 27, macOS 27, visionOS 27, and watchOS 27. The headline is “Claude in a Swift app.” The genuinely interesting part sits one layer down: the handoff pattern between the local model and the cloud, and the point where Apple turns that pattern into the documented standard path.
What the Foundation Models framework is — and where its ceiling sits
With the Foundation Models layer, Apple gives Swift developers direct access to a compact, device-optimized language model. It runs on the Neural Engine, with no network, no API key, and it’s tuned for exactly the tasks where latency and privacy matter: summarizing text, extracting fields from a document, classifying input, generating short suggestions.
That strength has a flip side. The on-device model is small. It has a limited context, no access to current information, and it isn’t built for multi-step reasoning or serious code generation. Push it to that edge and you get either thin answers or a task that simply doesn’t fit the local frame. That edge is exactly why a handoff makes sense in the first place.
Typed outputs instead of raw text
The core of the framework is guided generation. Instead of letting the model produce free text, you describe a Swift struct with @Generable, and the model fills it with typed values. The result isn’t a Markdown blob you have to parse afterward, but an instance the compiler knows.
@Generable
struct StudyPrompt {
@Guide(description: "The technical term in question")
let term: String
let difficulty: Int
let followUp: String
}
In a few lines you go from raw user input to a structured object. And this is where the new package plugs in. Because the on-device stage already yields typed values, you arrive at the Claude call with clean, validated inputs — not the user’s unfiltered original text. The pre-processing is done before the first token hits the API. That’s more than cosmetics: it turns the boundary between local and remote into a typed seam where it’s clear what gets passed along at all.
On-device generates, Claude reasons
The pattern is a division of labor, and at its core it’s a routing decision. The local models handle what’s cheap and latency-critical. As soon as a request calls for multi-step reasoning, code generation, or current information, it hands off to Claude.
Anthropic’s own examples trace the line cleanly. A journaling app generates daily prompts on-device — fast, local, free — and asks Claude only when it’s time to find threads across months of entries. A study app defines a term locally and hands off to Claude when the learner follows up: “why does this matter for everything else we’ve covered?” The first step is a definition, the second a synthesis across a lot of context. Different tasks, different models.
For the user it stays one surface. The package handles streaming, tool calls, and structured responses flowing straight back into the same SwiftUI view. Claude can also search the web for current information and execute code for data analysis — both things the local model fundamentally can’t do. All that changes is the model behind each step, not the view and not the data flow around it.
You could do this before — and what’s different now
You could already call the Anthropic API from Swift. A URLSession, a JSON body, a bit of SSE parsing for the streaming, and Claude answers. Nothing about that is new, and for many apps the direct API call stays the right approach.
What’s new is the embedding into the framework’s session abstraction. The Claude call looks like a Foundation Models call: the same way of running a session, the same typed Generable output, the same streaming interface into the view. Tool calls and structured responses are wired up, instead of being hand-assembled per project. The difference isn’t “you can reach Claude,” it’s “Claude and the local model look the same from inside the app.” And that’s the precondition for the next step.
Apple’s framework goes provider-neutral
The frame around it is the actual step. At WWDC 2026, Apple opened the Foundation Models framework so the provider behind a session can be swapped — Apple’s on-device model, Google’s Gemini, or Anthropic’s Claude — by updating a Swift Package Manager dependency, with no changes to the session logic or the rest of the app. You prototype locally and decide later which cloud provider takes the heavy steps, by swapping a dependency.
That shifts the role of the local model. It’s no longer just the cheap generalist but also the typed pre-stage and the router: it takes the raw input, shapes it into a @Generable structure, and decides whether the request stays local or gets escalated. The framework becomes a provider-neutral front, and the app logic stays decoupled from the concrete model. For Apple that’s strategically convenient: the company doesn’t have to build the best reasoning model in the world, it only has to own the layer every other model has to pass through.
The boundary runs at the handoff
One thing shouldn’t get lost here. The Claude part needs an Anthropic API key, and with the handoff the content leaves the device. The on-device stage stays local — the handoff does not. Anyone using the pattern for sensitive data makes a decision right at that boundary, and does so per request: does this stay on the device, or does it go to a cloud provider?
The typed pre-stage helps more than it first appears. Because the local model already turns the raw text into a defined structure, you can control which fields get escalated at all. Instead of shipping the entire journal to the API, only the extracted question goes. The boundary isn’t just a privacy line, it’s also a cost line: every local step is free and latency-less, every handoff costs tokens and a network round-trip. Good routing here is the same thing as good privacy and good cost management.
The bigger picture
To me that’s the more relevant news behind the announcement. Not “Claude can be called from Swift” — that worked before. Rather, that Apple is making the handoff between local and remote model the documented standard path, with typed boundaries in between and a swappable provider behind it.
It’s the same architectural question showing up everywhere right now: not bigger models, but the clean wiring between them. Who calls which model when, how the transition is typed, where the data crosses the boundary — those are the decisions that make an app good or bad today. Apple now supplies the rail for it. Which model ends up on the other side is one line in the dependency list.