Skip to content
affaan-m avatar

Foundation Models On Device

Apple FoundationModels guide for on-device LLM work in iOS 26, covering @Generable output and tool calling.

CCM score
75 of 100
skills.sh installs
11.9K
GitHub stars
312.6K
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers availability checks, single-turn and multi-turn sessions, guided generation with @Generable, custom tool calling, and snapshot streaming
  • Includes SwiftUI integration for PartiallyGenerated streams plus error handling for LanguageModelSession.ToolCallError
  • Enforces a 4,096 token limit across instructions, prompt, and output, and requires checking model.availability before creating a session
  • Designed for iOS 26+ apps that need privacy-preserving, offline-capable AI features without cloud dependencies

Install

$ npx -y skills add affaan-m/ecc --skill foundation-models-on-device -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

FoundationModels: On-Device LLM (iOS 26)

Patterns for integrating Apple's on-device language model into apps using the FoundationModels framework. Covers text generation, structured output with @Generable, custom tool calling, and snapshot streaming — all running on-device for privacy and offline support.

When to Activate

  • Building AI-powered features using Apple Intelligence on-device
  • Generating or summarizing text without cloud dependency
  • Extracting structured data from natural language input
  • Implementing custom tool calling for domain-specific AI actions
  • Streaming structured responses for real-time UI updates
  • Need privacy-preserving AI (no data leaves the device)

Core Pattern — Availability Check

Always check model availability before creating a session:

struct GenerativeView: View {
    private var model = SystemLanguageModel.default

Details

Repository
github.com/affaan-m/ecc
Categories
Mobile Apps, AI Agents & LLM Apps
First seen
Jul 14, 2026

More from affaan-m/ecc

All 257

Similar to Foundation Models On Device

More Mobile Apps