A simple, accessible SwiftUI chat framework. Provides ready-to-use message bubbles, a full markdown rendering pipeline, attachment galleries, and platform-adaptive views for iOS, macOS, and visionOS.
Built with accessibility as a first-class concern. VoiceOver navigation, Dynamic Type, and screen reader announcements are built into every component.
- Message bubbles with user/assistant layout, avatars, and timestamps
- Full markdown rendering: headings, lists, code blocks, blockquotes, tables, thematic breaks, and inline formatting (bold, italic, code, links)
- Streaming text animation with fade-in for newly appended content
- Image and file attachment galleries with alt text support
- Copy, share, read aloud, and save actions with VoiceOver announcements
- Cross-platform support (iOS via UIKit text views, macOS via AppKit text views)
- No third-party dependencies
- Swift 6.1+
- iOS 18+ / macOS 15+ / visionOS 2+
Add SwiftUIChat as a dependency in your Package.swift:
dependencies: [
.package(path: "../SwiftUIChat")
]Or from a git URL:
dependencies: [
.package(url: "https://github.com/Techopolis-Online/SwiftUIChat.git", from: "0.1.0")
]Then add the product to your target:
.target(
name: "YourApp",
dependencies: [
.product(name: "SwiftUIChat", package: "SwiftUIChat")
]
)Conform your message type to MessageDisplayable and your attachment type to AttachmentDisplayable:
import SwiftUIChat
struct MyMessage: MessageDisplayable {
typealias AttachmentType = MyAttachment
var id: UUID
var content: String
var isFromUser: Bool
var timestamp: Date
var attachmentItems: [MyAttachment]
}MessageBubbleView(
message: myMessage,
textToSpeechService: myTTSService
)StructuredMarkdownView(
content: "# Hello\n\nSome **bold** text and a [link](https://example.com)",
textColor: .primary,
isFromUser: false
)let blocks = MarkdownBlockParser.parse(markdownString)
for block in blocks {
switch block {
case .heading(let level, let text): ...
case .codeBlock(let language, let code): ...
case .table(let header, let alignments, let rows): ...
default: ...
}
}- Taylor Arndt
- Michael Doise
MIT License. See LICENSE for details.