SwiftUI AI chat components
The surfaces an AI feature needs: a streaming reply, a thinking state, prompt suggestion chips, the sources behind an answer and Siri-style orbs drawn in Metal.
About these pieces
One self-contained Swift file each, Apple frameworks only, from iOS 17.
Streaming Reply is the reply surface: text arrives token by token with a per-word fade and a cursor, inline code sits on blocks, and a long press lifts the message to copy or regenerate. Thinking State is the working placeholder, laid out like the reply it becomes, with an elapsed-seconds label. Prompt Chips is a snapping row of suggestions where the chosen chip morphs into the composer.
Source Stack folds an answer's citations into one pill of site badges that opens into numbered source cards, the badges flying out of the stack into their cards. Assistant Orb and Thought Orb are dark glass balls with a Siri-style voice wave inside, drawn by a Metal shader, whose palettes crossfade with the kind of work in progress.
Learn the technique: SwiftUI loading states guide, SwiftUI animations guide.
Questions
How the pieces work, and how to build the same thing yourself. Every piece's page has its full notes.
How do I stream text in SwiftUI like ChatGPT?
Append tokens to a string in @State as they arrive from an AsyncSequence, and animate each new word in. Streaming Reply does this with a per-word fade and a block cursor, and exposes copy and regenerate.
Do these pieces include an AI model or API client?
No. They are the interface only. Connect them to any model or API: Apple's Foundation Models framework, a server you run, or a hosted provider.
Keep browsing
Nearby collections, then every category in the library.
- Feedback5Reactions, ratings, status morphs, skeletons and outcomes.
- Text4Type that reveals, expands, holds pictures and renders as glass.
- Backgrounds2Quiet atmospheres: a Metal silk shader and a touch-reactive dot grid.
- Liquid Glass5Correct iOS 26 Liquid Glass with Material fallbacks.
- Buttons and controls7Buttons and dials with press depth, hold, drag and outcome states.
- Inputs and forms17Tracks, steppers, rails and fields built for the thumb, down to addresses, map pins and signatures.
- Cards5Cards with depth, motion, parallax and gesture-driven stacks.
- Lists7Rows, grids and carousels with swipe, drag-to-select, follow-the-latest and completion physics.
- Navigation7Floating docks, tracking tabs, stretchy headers and an A to Z index.
- Sheets5Toasts, confirmations, permission moments and guided tours.
- Motion1Gesture modifiers with real physics.
- Data and charts6Scrubbable charts, rings, streak heatmaps, live stats and odometers.
- Media8Photo viewing and cropping, story playback, attachments and link previews.
- Animations16Springs, gesture physics, transitions and morphs, across every category.
- Haptics33Pieces that tick, tap and confirm at the moment that matters.
Ready to build something better?
85 pieces, one file each, yours to keep. Start with the library or see what the whole app looks like.