foundation-models-on-device

Integrate Apple's FoundationModels framework for on-device text generation and structured data extraction.

1|Updated Apr 11, 2026
One-click install
npx skills add https://github.com/its-Basudeba/Care-HMS --skill foundation-models-on-device-its-basudeba
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: foundation-models-on-device
Source: https://github.com/its-Basudeba/Care-HMS/tree/main/.agent/skills/foundation-models-on-device
Command: npx skills add https://github.com/its-Basudeba/Care-HMS --skill foundation-models-on-device-its-basudeba

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill addresses the challenge of building AI-powered features that require high privacy, offline availability, and low latency by leveraging Apple's on-device FoundationModels framework.

Core Features & Use Cases

  • Structured Generation: Use the @Generable macro to enforce type-safe, structured output directly from the model.
  • Tool Calling: Extend model capabilities by defining custom tools for domain-specific tasks like data lookups or calculations.
  • Snapshot Streaming: Implement real-time UI updates by streaming structured responses as they are generated.
  • Use Case: Build a privacy-focused journaling app that categorizes user entries into structured tags or a travel assistant that performs local database lookups without sending user data to the cloud.

Quick Start

Initialize a new LanguageModelSession with custom instructions to begin generating structured responses on-device.

Frequently Asked Questions about foundation-models-on-device

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run on-device AI text generation in Swift for iOS 26+?

Run on-device AI text generation in Swift by initializing a LanguageModelSession with the FoundationModels framework, which processes text locally on iOS 26+ to ensure data privacy and offline availability.

Can I get structured output from an on-device LLM in Swift?

Yes, you can get structured output from an on-device LLM in Swift by applying the @Generable macro, which enforces type-safe data extraction directly from the model during generation.

Does the Apple FoundationModels framework support custom tool calling?

Yes, the Apple FoundationModels framework supports custom tool calling, allowing you to extend model capabilities for domain-specific tasks like local database lookups without sending data to the cloud.

What is the best way to update iOS UI in real-time during structured LLM generation?

Update iOS UI in real-time during structured LLM generation by implementing snapshot streaming, which streams structured responses from the FoundationModels framework directly to your interface as they are created.

How do I build a privacy-preserving AI app that works offline on iPhone?

Build a privacy-preserving AI app that works offline on iPhone by integrating the FoundationModels framework, ensuring all AI text generation and data extraction occur entirely on-device without leaving the hardware.

What are the limitations of on-device AI for iOS apps?

Limitations of on-device AI for iOS apps include a strict dependency on iOS 26+ and Apple Intelligence hardware, meaning older devices cannot run the FoundationModels framework for local text generation.