AppleFoundationModels

Generate structured Swift outputs from natural language using Apple's on-device Foundation Models.

18|Updated Nov 23, 2025
One-click install
npx skills add https://github.com/mosif16/codex-Skills --skill applefoundationmodels
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: AppleFoundationModels
Source: https://github.com/mosif16/codex-Skills/tree/main/skills/AppleFoundationModels
Command: npx skills add https://github.com/mosif16/codex-Skills --skill applefoundationmodels

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developers want to integrate powerful AI capabilities into their Apple applications while ensuring user privacy, offline functionality, and structured, reliable outputs. This Skill provides a comprehensive guide to leveraging Apple's on-device Foundation Models framework for natural language understanding, guided generation, and tool invocation.

Core Features & Use Cases

  • On-Device AI: Utilizes Apple's ~3 billion-parameter LLM running entirely on-device, ensuring privacy and offline access without data leaving the device.
  • Structured Output: Employs @Generable and @Guide macros to guarantee model responses conform to specific Swift types, eliminating unreliable string parsing.
  • Tool Invocation: Extends model capabilities by allowing it to autonomously call custom app functions (tools) to fetch real-time data or perform actions beyond its built-in knowledge.
  • Use Case: An app developer wants to add a feature that summarizes user notes and extracts key action items. This Skill guides them to use the Foundation Models framework for NLU and structured output, ensuring the extracted data is always in a usable format and user data remains private.

Quick Start

Help me integrate Apple's Foundation Models into my iOS app to extract structured data from user text, ensuring the output is always a valid Swift struct.

Frequently Asked Questions about AppleFoundationModels

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract structured data from user text in iOS without sending data to the cloud?

On-device Foundation Models run a ~3 billion-parameter LLM directly on iOS, iPadOS, macOS, and visionOS, keeping all user data private and offline. Use LanguageModelSession with @Generable macros to ensure extracted data always conforms to a Swift struct, eliminating unreliable parsing.

Can I use Apple's Foundation Models for tool calling and real-time data integration?

Yes. Tool invocation extends the model to autonomously call custom app functions, allowing it to fetch real-time data or perform actions beyond built-in knowledge. This enables guided structured output generation in real-world app flows like summarization and entity extraction.

What's the best way to guarantee my model output matches a Swift type?

Constrained decoding using @Generable and @Guide macros ensures all model responses conform to specific Swift types. This eliminates string parsing errors and guarantees usable, structured outputs for classification, tagging, and data generation tasks.

Does Foundation Models support content tagging and classification on Apple platforms?

Yes. The Content Tagging adapter produces structured labels for classification and tagging workflows. Foundation Models support these use cases across iOS, iPadOS, macOS, Mac Catalyst, and visionOS with full on-device processing and session-based interaction.

Can I integrate on-device AI into my app without third-party API dependencies?

Foundation Models run entirely on-device with no external API calls required, ensuring offline functionality and user privacy. The framework handles natural language understanding and structured output generation using only device resources and LanguageModelSession.

What are the limitations of on-device Foundation Models for complex NLP tasks?

Foundation Models excel at classification, tagging, summarization, and entity extraction with constrained decoding. Performance depends on device hardware; the ~3 billion-parameter model balances capability with on-device efficiency, best suited for guided generation rather than open-ended reasoning at scale.