how could developers leverage the foundation models in their apps
Asked on 06/11/2025
1 search
Developers can leverage the Foundation Models framework in their apps to create intelligent features that run on-device, ensuring privacy and offline availability. Here are some ways developers can utilize this framework:
-
Prompt Engineering: Developers can start by crafting effective prompts to interact with the model. This involves using Xcode's Playground to test and refine prompts, allowing the model to generate desired outputs, such as itineraries or personalized content. For more details, you can refer to the Code-along: Bring on-device AI to your app using the Foundation Models framework session.
-
Tool Calling: The framework supports tool calling, which allows the model to autonomously execute code defined in your app. This can be used to fetch up-to-date content or perform actions like creating a journal entry. This feature enhances the model's capabilities by integrating it with app-specific functions. More information can be found in the Deep dive into the Foundation Models framework session.
-
Structured Output: Developers can use guided generation to produce structured data, making it easier to integrate model outputs into app views. This involves marking existing types in your app as generable and using natural language guides to control generated values.
-
Safety and Guardrails: The framework includes built-in guardrails to ensure safe content generation. Developers are encouraged to design their apps with additional safety measures to handle user input responsibly and avoid generating inappropriate content. For more on this, see the Explore prompt design & safety for on-device foundation models session.
-
Performance Optimization: The framework is optimized for performance using state-of-the-art techniques like quantization and speculative decoding. Developers can profile and optimize their app's use of the model using tools like the Instruments App Profiling template.
By leveraging these capabilities, developers can create powerful, private, and performant features across Apple's platforms, enhancing user experiences with intelligent, on-device AI.

Code-along: Bring on-device AI to your app using the Foundation Models framework
Develop generative AI features for your SwiftUI apps using the Foundation Models framework. Get started by applying the basics of the framework to create an awesome feature. Watch step-by-step examples of how to complement the models with tools you build, stream results, and apply further optimizations for great performance.

Platforms State of the Union
Discover the newest advancements on Apple platforms.

Keynote
Don’t miss the exciting reveal of the latest Apple software and technologies.