foundation-models-on-device

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

Updated Jul 10, 2025
One-click install
npx skills add https://github.com/nubiv/my-nome --skill foundation-models-on-device-nubiv
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: foundation-models-on-device
Source: https://github.com/nubiv/my-nome/tree/main/nix-darwin/config/claude/skills/foundation-models-on-device
Command: npx skills add https://github.com/nubiv/my-nome --skill foundation-models-on-device-nubiv

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 @Generable to output data in predefined Swift types, ensuring type safety and easier parsing.
  • Tool Calling: Allow the LLM to invoke custom code for domain-specific actions, extending its capabilities.
  • Snapshot Streaming: Stream partially generated structured responses for real-time UI updates.
  • Privacy-Preserving AI: All processing happens on-device, meaning no sensitive data leaves the user's device.

Quick Start

Use the foundation-models-on-device skill to generate a short story about a space adventure.

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 integrate on-device LLMs into my iOS app for offline text generation?

You can integrate on-device LLMs into your iOS app by using the FoundationModels framework to generate text, summaries, and creative content locally without requiring network connectivity.

What iOS version is required to use the FoundationModels framework for on-device generative AI?

Using the FoundationModels framework for on-device generative AI requires iOS 26 or later to ensure local processing, privacy, and offline support.

How do I get structured Swift data output from an on-device LLM?

You can get structured Swift data output from an on-device LLM by using the @Generable attribute, which enforces type safety and simplifies parsing for predefined Swift types.

Can I stream partially generated structured responses for real-time iOS UI updates?

Yes, you can stream partially generated structured responses using snapshot streaming, which enables real-time UI updates as the on-device LLM generates output.

How do I allow an on-device LLM to invoke custom code for domain-specific actions in Swift?

You can allow an on-device LLM to invoke custom code by implementing tool calling, which extends the LLM's capabilities to execute domain-specific actions within your iOS application.

Does on-device LLM processing keep user data private on iOS?

On-device LLM processing keeps user data completely private because all generative AI tasks are executed locally on the device, ensuring no sensitive data ever leaves the user's hardware.