foundation-models-on-device

Integrate Apple FoundationModels for on-device text generation and structured output in iOS 26+ Swift apps.

1|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/riftzen-bit/gemini-setup --skill foundation-models-on-device-riftzen-bit
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: foundation-models-on-device
Source: https://github.com/riftzen-bit/gemini-setup/tree/main/skills/foundation-models-on-device
Command: npx skills add https://github.com/riftzen-bit/gemini-setup --skill foundation-models-on-device-riftzen-bit

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables iOS developers to integrate Apple's FoundationModels on-device so apps can generate, structure, and stream language model output without sending user data to external servers, providing privacy and offline capability.

Core Features & Use Cases

  • On-device generation: Text generation and guided generation for privacy-sensitive iOS apps using FoundationModels.
  • Structured output with @Generable: Generate typed Swift models and access predictable fields via generated PartiallyGenerated types for safer parsing.
  • Tool calling and snapshot streaming: Define app-specific tools callable by the model and stream PartiallyGenerated snapshots for progressive SwiftUI updates.
  • Use Case: Implement an iOS 26+ assistant that extracts structured calendar events from natural language, streams partial results to the UI, and invokes local search or database tools for enrichment.

Quick Start

Create a LanguageModelSession using FoundationModels to generate a CatProfile with @Generable and stream partial TripIdeas into a SwiftUI list.

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 Apple's on-device LLM for private text generation in my iOS app?

To use Apple's on-device LLM for private text generation, initialize a LanguageModelSession within FoundationModels to handle generation without sending user data to external servers. This provides offline text generation directly on the device.

Can I generate structured Swift models from language model output on iOS?

Yes, you can generate structured Swift models from language model output using the @Generable property wrapper. It creates typed Swift models with predictable fields and PartiallyGenerated types for safer parsing and direct UI integration.

Does FoundationModels support tool calling and streaming for SwiftUI updates?

FoundationModels supports tool calling and streaming for SwiftUI updates by defining app-specific tools and streaming PartiallyGenerated snapshots. This allows progressive UI rendering as the on-device model generates output.

What are the limitations of Apple's FoundationModels for on-device generation?

Limitations of Apple's FoundationModels include a 4,096 token context limit, single-session concurrency rules, and strict on-device privacy constraints. You must also handle model availability checks before attempting generation.

Is on-device LLM generation available offline for iOS apps?

On-device LLM generation is available offline for iOS apps, providing privacy and offline capability. It processes guided generation, tool calling, and streaming locally on devices running iOS 26 and later without external network calls.