Skip to content

ahmetbostanciklioglu/FoundationModelsSwiftUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

🧠 Foundation Models SwiftUI

A SwiftUI demo of Apple's on-device Foundation Models — streaming a structured to-do list from a natural-language prompt.

Platform Swift SwiftUI Foundation Models Xcode Stars Last Commit

📖 Overview

Foundation Models SwiftUI is a compact sample app that shows how to use Apple's on-device FoundationModels framework directly from SwiftUI. Tapping the Apple Intelligence toolbar button sends a text prompt to a LanguageModelSession, which generates a list of to-do items and streams them back into the UI as they are produced. The whole flow runs on device using Apple Intelligence — no server, network call, or API key required.

✨ Features

  • 🧩 Structured generation — a Todo model annotated with @Generable lets the language model produce strongly-typed results instead of raw text.
  • 🔄 Streaming responses — uses session.streamResponse(generating:) to update the list incrementally as each chunk arrives.
  • 📝 Prompt-driven to-do list — starts from an editable prompt (default: "Create a 10 item list") and renders the generated tasks in a SwiftUI List.
  • 🍎 On-device Apple Intelligence — powered entirely by the FoundationModels framework; nothing leaves the device.
  • 🏗️ Clean MVVM structure — a @MainActor ObservableObject view model drives an @ObservedObject view, with async/await handling the generation loop.

📸 Preview

Screenshot 2025-12-11 at 01 41 43 Screenshot 2025-12-11 at 01 41 55 Screenshot 2025-12-11 at 01 41 18 Screenshot 2025-12-11 at 01 41 34 Screenshot 2025-12-11 at 01 41 24

🚀 Getting Started

git clone https://github.com/ahmetbostanciklioglu/FoundationModelsSwiftUI.git
cd FoundationModelsSwiftUI
open FoundationModelsApp.xcodeproj

Open the project in Xcode, select a Foundation Models capable target, and press ⌘R to build and run.

📋 Requirements

  • iOS 26.1 or later (a device/simulator with Apple Intelligence and the Foundation Models framework)
  • Xcode 26+
  • Swift 5.0

🧑‍💻 Author

Ahmet Bostancıklıoğlu@ahmetbostanciklioglu · ahmetbostancikli@gmail.com

⭐ If this helped you, consider giving the repo a star!

About

SwiftUI demo of Apple's on-device Foundation Models: streaming a structured to-do list from a prompt.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages