foundation-models-on-device

Integrate Apple's FoundationModels framework for on-device LLM text generation in iOS 26+.

Updated Mar 2, 2026
One-click install
npx skills add https://github.com/unju-ai/ecc --skill foundation-models-on-device-unju-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: foundation-models-on-device
Source: https://github.com/unju-ai/ecc/tree/main/skills/foundation-models-on-device
Command: npx skills add https://github.com/unju-ai/ecc --skill foundation-models-on-device-unju-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables developers to integrate powerful on-device Large Language Models (LLMs) into their iOS applications, ensuring privacy and offline functionality.

Core Features & Use Cases

  • On-Device Text Generation: Generate text, summaries, and creative content directly on the user's device.
  • Structured Data Generation: Use the @Generable macro to output data directly into Swift types.
  • Tool Calling: Allow the LLM to invoke custom code for specific tasks.
  • Snapshot Streaming: Stream partially generated structured responses for real-time UI updates.
  • Use Case: Build a private journaling app that summarizes user entries on-device, or a note-taking app that automatically extracts action items into a structured format without sending data to the cloud.

Quick Start

Check if the FoundationModels are available on the device before attempting to create a language model session.

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 use on-device LLM text generation in an iOS app?

Structured output from an on-device LLM is achieved using the `@Generable` macro in Swift. This feature maps the generated text directly into specific Swift types, allowing you to extract data like action items into a structured format.

Can I implement tool calling with FoundationModels on iOS?

Tool calling with FoundationModels on iOS is fully supported. You can allow the on-device LLM to invoke custom Swift code for specific tasks, extending the model's capabilities within your application's offline environment.

Does on-device LLM support in iOS require a specific Xcode or Swift version?

On-device LLM support in iOS requires Swift and a standard Xcode development environment. You must also ensure the application targets iOS 26 or later, and verify that FoundationModels are available on the user's specific device before creating a session.

What is the best way to stream partially generated LLM responses in Swift?

The best way to stream partially generated LLM responses in Swift is using snapshot streaming. This feature streams structured responses from the FoundationModels framework in real-time, enabling immediate UI updates as the data is generated.

Why should I use an on-device LLM instead of a cloud-based API for my iOS app?

An on-device LLM ensures complete user privacy and full offline functionality by processing all text generation locally. This approach is ideal for private journaling or note-taking apps where sending user data to the cloud is undesirable.