←新闻详情

Claude Blog更新于 10月14日 11:13

Anthropic 发布 Swift 包,让 Apple 开发者通过 Foundation Models 框架调用 Claude

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

AI 导读

Anthropic 发布新的 Swift 包,为 Apple 的 Foundation Models 框架提供 Claude 支持,开发者可在本地模型处理摘要、抽取等任务后,把需要多步推理、代码生成或联网搜索的请求交给 Claude。该包处理流式输出、工具调用和结构化响应,可直接回填到 SwiftUI 视图,需使用 Anthropic API key,支持 iOS 27、iPadOS 27、macOS 27、visionOS 27 和 watchOS 27。

推荐理由

AI 评分 53

Anthropic 官方发布 Swift 包,让 Apple 开发者能在 Foundation Models 框架里把本地任务交给 Claude 处理。

主题

标签

正文

当前显示原文,中文全文译文尚未就绪。

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.

Explore more product news and best practices for teams building with Claude.

Customize Claude Code with mods

Product announcements Customize Claude Code with mods Customize Claude Code with mods Customize Claude Code with mods Customize Claude Code with mods Sep 30, 2026 Claude for Government is now generally available

Product announcements Claude for Government is now generally available Claude for Government is now generally available Claude for Government is now generally available Claude for Government is now generally available Sep 25, 2026 Build plugins for Claude

Product announcements Build plugins for Claude Build plugins for Claude Build plugins for Claude Build plugins for Claude Sep 23, 2026 Claude Marketplace: one place to discover plugins, agents, and services from our partners

Product announcements Claude Marketplace: one place to discover plugins, agents, and services from our partners Claude Marketplace: one place to discover plugins, agents, and services from our partners Claude Marketplace: one place to discover plugins, agents, and services from our partners Claude Marketplace: one place to discover plugins, agents, and services from our partners Transform how your organization operates with Claude

Product updates, how-tos, community spotlights, and more. Delivered monthly to your inbox.

Homepage Homepage Next Next Thank you! Your submission has been received! Oops! Something went wrong while submitting the form. (function () { // ---------- Claude helper ---------- function buildClaudeUrl(text) { const url = new URL('https://claude.ai/new'); url.searchParams.set('q', text || ''); return url.toString(); }

// ---------- Auto-grow helpers ---------- function sizeTextarea(el) { // Ensure UA defaults don't force a starting height el.setAttribute('rows', el.getAttribute('data-min-rows') || '1'); el.style.minHeight = '0px'; el.style.height = 'auto'; // allow shrink el.style.height = el.scrollHeight + 'px'; // fit content }

function initAutogrow(root = document) { root.querySelectorAll('textarea[data-autogrow]').forEach((el) => { if (el.dataset.autogrowInit) return; el.dataset.autogrowInit = 'true';

// Respect your existing pattern for default text const preset = el.getAttribute('data-default-text'); if (preset != null && !el.value) el.value = preset;

// Initial sizing sizeTextarea(el);

// Resize as you type el.addEventListener('input', () => sizeTextarea(el));

// In case fonts/styles load late and change line-height window.addEventListener('load', () => sizeTextarea(el), { once: true }); }); }

// ---------- Claude form initializer ---------- function initClaudeForms(root = document) { root.querySelectorAll('form[data-claude-form]').forEach((form) => { if (form.dataset.claudeInit) return; form.dataset.claudeInit = 'true';

const textarea = form.querySelector('[data-claude-textarea], textarea'); const trigger = form.querySelector('[data-claude-button], button[type="button"], a[data-claude-button]');

if (!textarea || !trigger) { console.warn('Claude form: missing textarea or trigger in', form); return; }

// If the trigger is a but has no type, force "button" so it won't submit if (trigger.tagName === 'BUTTON' && !trigger.hasAttribute('type')) { trigger.type = 'button'; }

// Keep from navigating away while still opening Claude if (trigger.tagName === 'A') { trigger.addEventListener('click', (e) => e.preventDefault()); }

// Optional: support data-default-text on the textarea const preset = textarea.getAttribute('data-default-text'); if (preset != null && !textarea.value) textarea.value = preset;

// Click opens Claude; submission is optional trigger.addEventListener('click', () => { const text = (textarea.value || '').trim(); if (!text) { textarea.focus(); return; }

window.open(buildClaudeUrl(text), '_blank', 'noopener');

const mode = form.getAttribute('data-claude-mode') || 'intercept'; if (mode === 'also') { // Submit after opening Claude form.submit(); } // intercept mode: do nothing (no submit) });

// (Optional) Keep an href in sync for right-click/open-in-new-tab UX if (trigger.tagName === 'A') { const syncHref = () => trigger.setAttribute('href', buildClaudeUrl((textarea.value || '').trim())); syncHref(); textarea.addEventListener('input', syncHref); textarea.addEventListener('change', syncHref); } }); }

// ---------- Boot ---------- function initAll(root = document) { initAutogrow(root); initClaudeForms(root); }

if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => initAll(), { once: true }); } else { initAll(); }

@Claude @Claude @Claude

Download app Download app Download app

Artifacts Artifacts Artifacts

Design Design Design

Connectors Connectors Connectors

Plugins Plugins Plugins

Skills Skills Skills

Claude in Chrome Claude in Chrome Claude in Chrome

Claude for Microsoft 365 Claude for Microsoft 365 Claude for Microsoft 365

AI agents AI agents AI agents

Code modernization Code modernization Code modernization

Coding Coding Coding

Commerce Commerce Commerce

Customer support Customer support Customer support

Cybersecurity Cybersecurity Cybersecurity

Legal Legal Legal

Sales Sales Sales

Financial services Financial services Financial services

Government Government Government

Healthcare Healthcare Healthcare

Higher education Higher education Higher education

K-12 teachers K-12 teachers K-12 teachers

Life sciences Life sciences Life sciences

Nonprofits Nonprofits Nonprofits

Small business Small business Small business

Scientists Scientists Scientists

Developer docs Developer docs Developer docs

Developer blog Developer blog Developer blog

Console Console Console

Engineering at Anthropic Engineering at Anthropic Engineering at Anthropic

Overview Overview Overview

Marketplace Marketplace Marketplace

Claude on AWS Claude on AWS Claude on AWS

Blog Blog Blog

Claude partner network Claude partner network Claude partner network

Customer stories Customer stories Customer stories

Powered by Claude Powered by Claude Powered by Claude

Service partners Service partners Service partners

Availability Availability Availability

Check files Check files Check files

Regional compliance Regional compliance Regional compliance

Report abuse Report abuse Report abuse

Security and compliance Security and compliance Security and compliance

Status Status Status

Support center Support center Support center

Anthropic Anthropic Anthropic

Anthropic news Anthropic news Anthropic news

Policy on the AI Exponential Policy on the AI Exponential Policy on the AI Exponential

Transparency Transparency Transparency

Privacy choices /* Dialog styling */ dialog#consent-container { margin: 0; padding: 8px; opacity: 0; transform: translateY(16px); transition: opacity 0.3s ease-out, transform 0.3s ease-out; }

dialog#consent-container.show { opacity: 1; transform: translateY(0); }

dialog#consent-container::backdrop { background: transparent; }

dialog button span { display: inline !important; }

/* Toggle switch styling */ .toggle_switch { position: relative; display: inline-block; width: 36px; height: 24px; }

.toggle_switch input { opacity: 0; width: 0; height: 0; }

.toggle_slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #87867f; transition: .4s; border-radius: 24px; }

.toggle_slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }

input:checked + .toggle_slider { background-color: #d97757; }

input:checked + .toggle_slider:before { transform: translateX(12px); }

input:disabled + .toggle_slider { cursor: not-allowed; opacity: 0.5; }

@media only screen and (max-width: 501px) { dialog#consent-container { left: 8px !important; bottom: 8px !important; right: 8px !important; } #consent-banner { padding: 24px 16px 16px !important; } #simple-options { grid-template-columns: repeat(3, 1fr) !important; grid-template-rows: auto auto !important; } #customize-btn { grid-column: span 1 !important; } dialog button span { display: none !important; }

Cookie settings

Enables security and basic functionality.

Enables tracking of site performance.

Enables ads personalization and tracking.

Responsible disclosure policy Responsible disclosure policy Responsible disclosure policy

Usage policy Usage policy Usage policy

来源

Claude Blog