Your question rises to the top and the answer streams in under it as Markdown, the way Siri answers. Photos run full width, cards you design sit inside the reply, and a status line tells people what the assistant is doing.
Hand it your messages as usual, then switch the style. Stream a reply by appending one message and rewriting its text as tokens arrive.
https://github.com/unionst/swift-chat.git
Chat(thread.messages, typingUsers: thread.thinking ? [assistant] : []) { message in
Message(message.text, role: message.role, timestamp: message.sentAt)
.messageMedia(message.media)
}
.chatStyle(.assistant)
.chatTypingStatus(thread.status)
.chatInputCapabilities([.camera, .photoLibrary, .files])
.onChatSend { text, media in
await thread.send(text, media)
}
The style is the layout. What an agent does inside it is built in too: a status line that follows it through each tool call, results drawn as your own SwiftUI views, suggestions to tap, and turn-taking that waits for you to finish typing.
.chatTypingStatus("Searching restaurants nearby")
.chatInputSuggestions(thread.openers)
.onChatInputSuggestionTap { suggestion in
thread.send(suggestion.text)
}
See an agent running, or read the agent guide.