Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

FlowToken Swift

Native SwiftUI animation for streaming LLM output. No dependencies.

Install

Add FlowToken to your Swift package:

.package(url: "https://github.com/undivisible/flowtoken-swift.git", from: "0.1.0")

Then add "FlowToken" to the target dependencies.

Token streaming

Use TokenizedText for plain streamed output. The view preserves whitespace, wraps at its container width, and animates only newly appended tokens.

import FlowToken
import SwiftUI

struct ReplyView: View {
    let reply: String

    var body: some View {
        TokenizedText(reply, separator: .word, animation: .blurIn)
    }
}

separator accepts .diff (the default, one animation per streamed chunk), .word, and .character.

Markdown

Use AnimatedMarkdown when SwiftUI's native Markdown rendering is more important than per-token animation:

AnimatedMarkdown("## Hello, **world**!", animation: .fadeIn)

API

  • TokenizedText(_:separator:animation:animationDuration:)
  • AnimatedMarkdown(_:animation:animationDuration:)
  • FlowTokenSeparator: .diff, .word, .character
  • FlowTokenAnimation: .fadeIn, .blurIn, .dropIn, .slideUp, .scaleIn, .none

Development

swift test

License

ISC

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages