A SwiftUI chat application built with Apple's Foundation Models framework, showcasing on-device AI capabilities.
- iOS 26.0+ / iPadOS 26.0+ / macOS 26.0+ / visionOS 26.0+
- Xcode 26.0+ (with iOS 26 SDK)
- Device with Apple Intelligence support
- Apple Intelligence must be enabled in Settings
- ✅ On-device AI chat with no internet required
- ✅ Real-time streaming responses
- ✅ Automatic availability checking
- ✅ Context management
- ✅ Safety guardrails
- ✅ Performance optimizations
- ✅ Clean SwiftUI interface
- Open
FoundationChat.xcodeprojin Xcode - Ensure your development device has Apple Intelligence enabled
- Build and run on a supported device (not simulator for accurate performance)
Always check if the model is available before use:
guard SystemLanguageModel.default.isAvailable else {
// Show fallback UI
return
}let session = LanguageModelSession()
let response = try await session.respond(to: "Hello!")
print(response.content)for try await chunk in session.streamResponse(to: prompt) {
// Update UI with partial content
}- Examples - Detailed implementation examples
This is an example project demonstrating Foundation Models usage. Feel free to fork and experiment!
MIT License - See LICENSE file for details