Back to projects

iOS / SwiftUI / Local AI

Localight

Localight is a small demo app for trying Apple’s on-device language models in a native iOS chat interface. It is built around fast, private, offline responses without a server or internet connection.

SwiftUIiOS 26iOS 27Foundation ModelsLocal AI

Purpose

What it is for

The project exists to show how a local LLM can feel inside a focused SwiftUI app. It keeps the product surface intentionally small, so the important parts are the Foundation Models integration, the session lifecycle, model availability handling, and the user-facing chat flow.

Behavior

What it does

Conversations are generated locally through SystemLanguageModel and LanguageModelSession.
The app supports streaming responses, editable model instructions, adjustable temperature, session prewarming, and clearing the current chat.
On iOS 27, it also demonstrates context usage, per-message token usage, single-image attachments, and typed generation error alerts.
Chat history is intentionally not persisted after the app closes.

Implementation

How it is built

The codebase keeps separate iOS 26 and iOS 27 implementations so API differences stay explicit.

LocalightApp selects the right implementation for the current operating system.

Version-specific files and types use _26 and _27 suffixes, with grouped folders for chat, model, settings, and reusable components.

Error handling maps model availability and generation failures into user-facing fallbacks instead of exposing raw framework errors.