Skip to content

Techopolis/SwiftUIChat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftUIChat

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.

Features

  • 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

Requirements

  • Swift 6.1+
  • iOS 18+ / macOS 15+ / visionOS 2+

Installation

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")
    ]
)

Usage

Define your message model

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]
}

Display a message bubble

MessageBubbleView(
    message: myMessage,
    textToSpeechService: myTTSService
)

Render markdown standalone

StructuredMarkdownView(
    content: "# Hello\n\nSome **bold** text and a [link](https://example.com)",
    textColor: .primary,
    isFromUser: false
)

Parse markdown blocks

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: ...
    }
}

Contributors

  • Taylor Arndt
  • Michael Doise

License

MIT License. See LICENSE for details.

About

A simple, accessible SwiftUI chat framework with markdown rendering, message bubbles, and VoiceOver support.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages