Apple On-Device Foundation Models

•
10
•

Integrates Apple's on-device FoundationModels framework into iOS apps for private, offline LLM inference, structured output, and tool calling.

This skill guides developers through implementing Apple's on-device FoundationModels framework for iOS, enabling secure, offline AI capabilities powered by Apple Intelligence. It provides production-ready Swift patterns for checking model availability, single and multi-turn conversations, type-safe guided generation using the @Generable macro, custom domain tool invocation, and snapshot streaming for responsive SwiftUI interfaces, all while respecting device token constraints and privacy-first architectural standards.

Key Features

01Custom domain tool calling with structured argument schemas and explicit error handling
0210 GitHub stars
03Pre-flight availability checks for Apple Intelligence device eligibility and model download states
04Context window management and chunking tailored to the 4,096-token on-device budget
05Type-safe structured data generation using the Swift @Generable macro and @Guide constraints
06Snapshot streaming with PartiallyGenerated types for real-time, non-blocking SwiftUI rendering

Use Cases

01Building privacy-preserving iOS apps that summarize notes and generate text completely offline
02Extracting structured Swift objects from conversational or unstructured user inputs
03Empowering on-device agents to query local SQLite databases or system APIs via tool calling