BuildSpeak每日 builder 文摘
今日归档生词本关于
📰 博客Claude Blog· 2026 年 6 月 8 日· 348 词 · 约 2 分钟

Building intelligent apps for Apple platforms with Claude in the Foundation Models framework

SPACE 播放 / 暂停·←→ 上一句 / 下一句
Today we're releasing Foundation Models framework support for Claude through a new Swift package that lets Apple developers use Apple's Foundation Models framework to call Claude for more complex workflows. Apple’s Foundation Models framework gives developers access to tap into models natively from Swift. It is very easy to use and can return typed Swift values through guided generation in as few as three lines of code. Developers can use this to tap into Apple’s on-device models for fast, local tasks like summarization or extraction. Developers can now use Apple’s Foundation Models framework to hand off to Claude when a request calls for multi-step reasoning, code generation, and more. Claude can also search the web for current information and execute code for data analysis. Stream Claude's response back into the same view. Because Apple's framework returns typed Swift values from @Generable annotations, developers arrive at the Claude API call with clean inputs instead of raw user text. What this unlocks The Foundation Models framework already powers a range of intelligent on-device features — journaling apps that surface personalized prompts, document apps that summarize contracts, learning apps that explain a concept at a student's level. Adding Claude extends each of those patterns. A journaling app can generate daily prompts on-device, then ask Claude to find threads across months of entries. A study app can define a term on-device, then hand off to Claude when the student follows up with "why does this matter for everything else we've covered?" It's one experience for the user, backed by the right model for each step. Getting started Claude support with the Foundation Models framework will be available tomorrow and works through Apple's Foundation Models framework on iOS 27, iPadOS 27, macOS 27, and visionOS 27, and watch OS 27. Add it to your project, sign in with an Anthropic API key, and pass typed outputs from Apple's on-device pass into a Claude request — the package handles streaming, tool calls, and structured responses back into your SwiftUI view.
今天,我们通过一个新的 Swift package 发布了对 Claude 的 Foundation Models framework 支持,使 Apple 开发者能够使用 Apple 的 Foundation Models framework 在更复杂的工作流中调用 Claude。Apple 的 Foundation Models framework 让开发者可以直接从 Swift 原生访问模型。它非常易用,借助 guided generation(引导式生成),最少只需三行代码就能返回带类型的 Swift 值。开发者可以用它调用 Apple 的 on-device models(端侧模型),来完成如摘要或信息提取这类快速、本地的任务。现在,当请求需要 multi-step reasoning(多步推理)、code generation(代码生成)等能力时,开发者也可以使用 Apple 的 Foundation Models framework 将任务转交给 Claude。Claude 还可以搜索网络以获取最新信息,并执行代码进行数据分析。你还可以将 Claude 的响应流式传回同一个视图。由于 Apple 的 framework 会通过 @Generable annotations 返回带类型的 Swift 值,开发者在发起 Claude API 调用时拿到的是干净的输入,而不是原始的用户文本。这带来了什么 Foundation Models framework 已经为一系列智能端侧功能提供支持——例如能呈现个性化提示的 journaling apps、能总结合同的 document apps,以及能按学生水平解释概念的 learning apps。加入 Claude 后,这些模式都可以进一步扩展。一个 journaling app 可以先在设备端生成每日提示,然后再让 Claude 找出数月日记条目之间的线索;一个 study app 可以先在设备端定义术语,然后当学生继续追问“why does this matter for everything else we've covered?”时,再把任务交给 Claude。对用户来说,这是一次统一的体验,而背后每一步都由最合适的模型来完成。开始使用 对 Foundation Models framework 的 Claude 支持将于明天上线,并可通过 Apple 的 Foundation Models framework 在 iOS 27、iPadOS 27、macOS 27、visionOS 27 和 watch OS 27 上运行。把它添加到你的项目中,使用 Anthropic API key 登录,然后将 Apple 端侧处理步骤输出的带类型结果传入 Claude 请求——这个 package 会负责将流式输出、tool calls(工具调用)和 structured responses(结构化响应)回传到你的 SwiftUI 视图中。
原文 ↗https://claude.com/blog/claude-for-foundation-models
BuildSpeak — 关于本项目BUILT IN PUBLIC · 跟随 builders 而非 influencers