Exploring On-Device AI for Apple Platforms Development
Complete Guide to Foundation Models and MLX Swift for iOS & macOS Apps
Overview
"This book has allowed me to be what I saw myself as being with Foundation Models. I feel I can legitimately use them expressively now. I needed this.
~Adrian Eves
This bundle includes both books in the "Exploring AI for iOS Developers" series, providing everything you need to build on-device AI apps for Apple platforms.
Foundation Models Book
This book teaches iOS, macOS, and visionOS developers how to use Apple's Foundation Models into their apps. Build features like streaming interfaces, structured data extraction, tool calling, and more.
All running on-device with Apple's privacy guarantees.
What you get:
- 156 pages PDF
- EPUB for Kindle
- LLMs text to use with AI (~41,354 tokens)
MLX Swift Book
This book teaches iOS and macOS developers how to take advantage of Apple Silicon powers with MLX Swift for on-device machine learning. Build AI apps with custom models, quantization, vision-language, and speech synthesis.
What you get:
- 155 pages PDF
- EPUB for Kindle
- LLMs text to use with AI (~46,946 tokens)
Complete Table of Contents
Foundation Models with Apple Intelligence
1. Introduction to Foundation Models
Apple's framework for accessing on-device Apple Intelligence models, including guided generation, tool calling, and stateful sessions for iOS 26.0+
2. Getting Started with Sessions
Setting up your first AI session and understanding model availability, error handling and different generation configuration options.
3. Generation Options and Sampling Control
Shaping model behavior with temperature, penalties, and other parameters to control output quality and creativity
4. Streaming and Snapshots
Building responsive UIs with partial results and understanding how Foundation Models streams complete object snapshots instead of token deltas
5. Structured Generation with Schemas
Creating type-safe, structured output directly from AI responses using the @Generable framework
6. Advanced Chat Patterns
Building production-ready conversation interfaces with context management, memory handling, and graceful error recovery
7. Basic Tool Use
Enabling your AI to perform actions and access real-world data with practical examples of working with web search APIs
8. Integrating External JSON APIs
Reusing your Foundation Models schemas with external providers like OpenAI, Anthropic, and Google through JSON Schema compatibility
9. Safety and Best Practices
Implementing responsible AI features with proper guardrails, user protection, and Apple's safety principles for trustworthy experiences
10. Supported Languages and Internationalization
Working with Foundation Models across 14 supported locales, handling multilingual conversations, and session management strategies for global apps
Upcoming chapters:
11. Foundation Models And App Intents
Using Foundation Models in app extensions, widgets, shortcuts, and system integrations while maintaining session-based patterns
12. Dynamic Generation Schemas
Runtime schema construction and complex data modeling for advanced structured generation patterns
13. Advanced Tool Patterns
Production integrations with external APIs and services, including retry strategies, fallback handling, and security considerations
14. Performance Optimization and Profiling
Using Foundation Models instruments in Xcode for production deployment, including memory management, token optimization, and performance monitoring
15. Training Custom Adapters
Specializing Foundation Models for your app's domain and writing style using Apple's adapter training toolkit with cost-effective cloud GPU workflows
MLX Swift for On-Device Intelligence
1. Introduction to MLX
Understanding the fundamentals of the MLX framework and its role in Apple development, including battery life considerations for on-device AI
2. Understanding AI Model Components
The components that make up AI models, including licensing considerations for App Store submissions
3. Loading Models with MLX Swift
How to load various model architectures using MLX Swift, with error handling for network failures and retry strategies
4. Getting Started with MLX Swift
Setting up your development environment and running your first MLX Swift code, with realistic performance expectations for different devices
5. Working with Pre-Trained Models
Using existing open-weights models for different tasks, including memory management and testing strategies for actual devices vs simulators
6. Model Quantization
Techniques to make large AI models smaller and faster for on-device performance, and when to avoid quantization
7. Text Embeddings with MLX Embedders
Using text embedding models to understand semantic meaning of text for search and comparison, with storage for large datasets
8. Customizing Generation Parameters
Fine-tuning parameters like temperature and top-k to control generative model output, with debugging techniques and parameter logging strategies
9. Vision-Language Models
Working with models that understand and describe image content, including image preprocessing best practices and quality considerations
10. MLX Swift Tools
Utilities for MLX Swift development, including integration tips for CI/CD pipelines and automated testing
11. Tool Use with Models
Enabling language models to interact with external tools and APIs, with security considerations and input validation strategies
12. Generative Vision with Image Tool
Working with models that generate and manipulate images based on text instructions, with result evaluation techniques and failure pattern analysis
13. Structured Generation with @Generable
Using Foundation Models' schema system to get type-safe, structured responses from MLX Swift models
14. On-Device TTS with MLX Audio
Building Kokoro and Sesame-based TTS with streaming and raw audio access for natural, human-like speech synthesis
Upcoming chapters:
15. Concurrent Session Processing & Performance Optimization
Advanced techniques for maximizing throughput with concurrent processing, batch optimization, KV cache management, and production-ready patterns for high-performance on-device AI applications
Use the code "STUDENT" for a discount if you are a student.
© Copyright 2025 — Rudrank Riyam's Academy