foundation-models-on-device
On-device LLM integration for iOS 18+ using Apple's FoundationModels framework with privacy-first text generation and structured output.
- Covers text generation, structured output via
@Generablemacro, custom tool calling, and snapshot streaming—all running locally without cloud dependency - Requires availability checks before session creation; supports single-turn and multi-turn conversations with optional system instructions
- Guided generation with
@Guideconstraints (numeric ranges, array counts, semantic hints) produces strongly-typed Swift structs instead of raw strings - Tool calling lets models invoke custom functions for domain-specific tasks; streaming mode progressively yields partial results for real-time UI updates
- 4,096 token context limit applies across instructions, prompt, and output combined; single request per session enforced via
isRespondingflag
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 {
More from affaan-m/everything-claude-code
security-review
Use this skill when adding authentication, handling user input, working with secrets, creating API endpoints, or implementing payment/sensitive features. Provides comprehensive security checklist and patterns.
7.9Kgolang-patterns
Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.
7.5Kcoding-standards
Baseline cross-project coding conventions for naming, readability, immutability, and code-quality review. Use detailed frontend or backend skills for framework-specific patterns.
6.7Kfrontend-patterns
Frontend development patterns for React, Next.js, state management, performance optimization, and UI best practices.
6.6Kbackend-patterns
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
6.6Kgolang-testing
Go testing patterns including table-driven tests, subtests, benchmarks, fuzzing, and test coverage. Follows TDD methodology with idiomatic Go practices.
6.1K