Contents

chrisnyw/aieffectskit

The visual language of generative AI for SwiftUI — state-driven, accessibility-correct, ready for Metal acceleration.

Why

Apple Intelligence has settled into a recognisable visual language — the breathing glow, the streaming reveal, the trailing shimmer. No library packages it coherently. AIEffectsKit fills that gap with a small surface of composable, state-driven SwiftUI primitives.

Install

Swift Package Manager:

.package(url: "https://github.com/<owner>/AIEffectsKit.git", from: "0.2.0")

Then:

import AIEffectsKit

Components at a glance

| Component | Description | |---|---| | StreamText | Token-by-token reveal driven by any AsyncSequence<String>. Eleven styles — .trailingShimmer, .typewriter, .wordReveal, .tokenChunks, .fadeRise, .blurFocus, .shimmerWipe, .skeleton, .scramble, .letterDrop, .lineCascade. | | ThinkingIndicator | Compact three-dot pulse that renders only while AIState.phase == .thinking. | | .intelligenceGlow(…) | View modifier — animated rotating gradient border. Activates from a shared AIState or an explicit activeWhen: flag. | | AIState / AIPhase | Shared observable state: .idle · .listening · .thinking · .streaming · .done · .error(String). Injected via .aiState(_:). |

Output samples

| Component | Preview | |---|---| | StreamText | <img src="Assets/streamtext-demo.gif" alt="Integrated hero — demonstrate status chip indicator" width="250"></p> | | IntelligenceGlow | <img src="Assets/intelligenceglow-demo.gif" alt="Integrated hero — demonstrate status chip indicator" width="250"></p> | | ThinkingIndicator | <img src="Assets/thinking-indicator-demo.gif" alt="Integrated hero — demonstrate status chip indicator" width="250"></p> |

Quick start — `StreamText`

Wrap any AsyncSequence<String>, choose a style:

StreamText(llmTokenStream, style: .trailingShimmer())
    .font(.title3)

Pick any of the eleven styles:

StreamText(source, style: .typewriter())
StreamText(source, style: .wordReveal())
StreamText(source, style: .shimmerWipe())
// …

For demos and deterministic previews, use the built-in typing helper:

StreamText.typing(
    "The quick brown fox jumps over the lazy dog.",
    interval: .milliseconds(30),
    style: .fadeRise()
)

Quick start — `IntelligenceGlow`

A modifier that paints an animated gradient border around any surface:

ChatBubble()
    .intelligenceGlow(
        colors: [.blue, .purple, .pink, .blue],
        lineWidth: 2,
        cornerRadius: 16,
        activeWhen: true            // or omit to read AIState from the environment
    )

When wired to an AIState, the glow breathes only while the phase is active (listening / thinking / streaming).

Quick start — `ThinkingIndicator`

VStack {
    ThinkingIndicator()            // renders only while .phase == .thinking
    Text("Working on it…")
}
.aiState(state)

Tying it together with `AIState`

@State private var state = AIState()

VStack {
    ThinkingIndicator()
    StreamText(tokenStream)
        .intelligenceGlow(cornerRadius: 16)
}
.aiState(state)

StreamText reports its own phase transitions (.streaming.done / .error) to the injected AIState; the indicator and the glow both observe the same instance.

Platforms

  • iOS 17+, macOS 14+, watchOS 10+, visionOS 1+
  • Xcode 16+ / Swift 5.10+ (Swift 6 strict concurrency supported)
  • The TextRenderer shimmer engages on iOS 18 / macOS 15 / watchOS 11 / visionOS 2 and later; earlier targets get a plain animated Text fallback.

Accessibility

Every animated effect collapses to a static, phase-appropriate fallback when any of:

  • accessibilityReduceMotion
  • accessibilityReduceTransparency
  • ProcessInfo.isLowPowerModeEnabled

is on. No configuration required.

Demo

Open Example/AIEffectsKitDemo.xcodeproj and run — the project references this package locally (XCLocalSwiftPackageReference "..") so there's no dependency resolution step.

The demo ships four screens grouped as Components (each effect on its own) + Integration (everything together). See Example/README.md.

Roadmap

| Release | Scope | Status | |---|---|---| | v0.1.0 | StreamText solo (iOS 18 TextRenderer, one style) | ✅ shipped | | v0.2.0 | ThinkingIndicator, pure-SwiftUI IntelligenceGlow, AIState wiring, StreamText expanded to 11 styles, accessibility infra, demo feature-folder architecture | ✅ shipped | | v1.0.0 | Metal layerEffect, AIRipple, GenerationPlaceholder, hero demo app, FoundationModelsKit integration | planned |

See AIEffectsKit-PLAN.md for positioning, market research, and kill-switches.

License

MIT — see LICENSE.

Package Metadata

Repository: chrisnyw/aieffectskit

Default branch: main

README: README.md