How do I implement foundation models in my app?

Asked on 2026-10-08

1 search

To implement Foundation Models in your app, the basic flow is:

  1. Import the framework
  2. Create a language model session
  3. Send a prompt to the model
  4. Optionally add:
    • Structured output with Generable
    • Streaming responses
    • Tool calling for app actions
    • Stateful sessions for multi-turn interactions

Apple showed that the simplest version is basically “three lines of code”: import the framework, create a session, and call respond with your prompt.

What you can build with it

  • Text generation
  • Summarization
  • Text extraction and analysis
  • Structured outputs
  • Tool-using agents
  • Personalized app experiences

Important notes

  • It runs on device in Apple’s framework, so it’s private and can work offline.
  • The framework is built into the OS, so it doesn’t increase app size.
  • You can also use newer capabilities like guided generation and tool calling to make the model more useful in your app.

Good WWDC sessions to start with

  • Meet the Foundation Models framework
  • Deep dive into the Foundation Models framework
  • Code-along: Bring on-device AI to your app using the Foundation Models framework

If you want, I can also give you a minimal Swift example of using a Foundation Models session in your app.