Apple FoundationModels framework for on-device LLM — text generation, guided generation with @Generable, tool calling, and snapshot streaming in iOS 26+.
The foundation-models-on-device skill enables developers to integrate Apple's on-device language models into iOS applications using the FoundationModels framework. It allows apps to perform text generation, structured output generation, tool calling, and snapshot streaming directly on the device. By leveraging on-device processing, this skill ensures privacy and offline functionality, removing the need for cloud connectivity while still providing advanced AI capabilities. This approach solves the challenge of creating responsive and secure AI features within apps while keeping sensitive data entirely on the user's device.
This skill supports multiple core patterns. Developers can create single-turn or multi-turn language model sessions, specify detailed instructions for the model, and define its role and style preferences. The guided generation feature with @Generable enables producing structured Swift types instead of raw text, supporting constraints like numeric ranges, array counts, and semantic guidance. Additionally, developers can implement custom tool calling, allowing the model to trigger domain-specific code or actions. Snapshot streaming facilitates real-time UI updates with structured responses. These capabilities provide a flexible and developer-friendly approach to building sophisticated AI-powered features on iOS.
Typical use cases include generating and summarizing text offline, extracting structured data from natural language input, implementing AI-driven tools for specific tasks, and maintaining user privacy. Target users are iOS developers building AI-enhanced apps, especially those who need privacy-preserving solutions or want to offer AI features without relying on cloud services. It is particularly suitable for applications in domains such as productivity, content generation, education, and personalized assistant experiences.
This skill requires iOS 26 or later to support on-device FoundationModels features.
Yes, all processing runs on-device, so the model can generate text and structured outputs without an internet connection.
You should perform an availability check using the model's availability property before creating a session, handling cases like device not eligible, Apple Intelligence not enabled, or model not ready.
You can use the @Generable annotation to define Swift types with constraints such as numeric ranges, array counts, and descriptive guidance to produce structured responses instead of raw strings.
Yes, developers can define custom Tool structs that the model can invoke with structured arguments, enabling domain-specific AI actions.
Quick Setup:
.claude/skills/Repository
affaan-m/everything-claude-code