Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.prism.byescaleira.com/llms.txt

Use this file to discover all available pages before exploring further.

Whether you’re evaluating Prism for a new project or working through an integration detail, this page collects the questions developers ask most often. If your question isn’t covered here, open a discussion on the GitHub repository.
Prism requires Swift 6.3 and Xcode 16.4 or later. The minimum deployment targets are:
PlatformMinimum version
iOS26
macOS26
tvOS26
watchOS26
visionOS26
The package is compiled with strict concurrency enabled across all targets, so it is designed to work cleanly in a Swift 6 codebase without concurrency warnings.
Yes. Each module is a separate Swift Package Manager target, so you can depend on only what your app needs:
// Package.swift
.target(
    name: "MyApp",
    dependencies: [
        .product(name: "PrismUI", package: "prism"),
        .product(name: "PrismNetwork", package: "prism"),
    ]
)
You can then import only those modules:
import PrismUI       // design system only
import PrismNetwork  // networking only
Use import Prism when you want the umbrella re-export that pulls in all seven modules at once.
Importing individual modules keeps compile times lower and makes the dependency graph explicit — a good practice for large projects.
Plain SwiftUI gives you building blocks; PrismUI gives you a finished design system on top of them. The main differences are:
  • Design tokens: every color, spacing, radius, elevation, typography, and motion value comes from a semantic token rather than a hardcoded literal. Swapping a theme changes the entire app’s appearance instantly.
  • 80+ pre-built components: buttons, cards, forms, navigation, chat, charts, and more — all theme-aware, accessible, and following Apple HIG out of the box.
  • Accessibility built in: VoiceOver labels, Dynamic Type scaling, WCAG contrast validation, and reduce-motion support are included by default.
  • Consistent animation: spring and motion tokens with reduce-motion awareness, so you never hardcode durations.
You still write SwiftUI — PrismUI components are standard View types and compose normally with any SwiftUI code you already have.
Yes. The package manifest enables strict concurrency across all targets, and the entire codebase compiles cleanly under Swift 6’s complete concurrency model. Specifically:
  • All actors are properly isolated (PrismStore, PrismNetworkClient, PrismEmbeddingStore, and others are actor types)
  • Public types that cross concurrency boundaries conform to Sendable
  • UI components are annotated @MainActor where required
You can add Prism to a Swift 6 project without suppressing concurrency warnings.
Implement the PrismTheme protocol to provide your own token values, then apply it to your root view:
import PrismUI

struct MyBrandTheme: PrismTheme {
    var colors: ColorTokens { MyColorTokens() }
    var typography: TypographyTokens { MyTypographyTokens() }
    var spacing: SpacingTokens { DefaultSpacingTokens() }
    var radius: RadiusTokens { DefaultRadiusTokens() }
    var elevation: ElevationTokens { DefaultElevationTokens() }
    var motion: MotionTokens { DefaultMotionTokens() }
}

// Apply to your root view
ContentView()
    .prismTheme(MyBrandTheme())
For quick brand customization, use the built-in BrandTheme with your primary, secondary, and accent colors:
let theme = BrandTheme(primary: .indigo, secondary: .mint, accent: .orange)
ContentView()
    .prismTheme(theme)
You can also generate a full theme automatically from a single seed color using PrismAutoTheme, which applies color harmony strategies (complementary, analogous, triadic, or split-complementary) to derive the complete token set.
Use PrismThemeEditor during development to tweak colors, spacing, and radius live at runtime, then export the result as JSON.
Prism defines a PrismAnalyticsProvider protocol. Implement it for your analytics service and pass it to the .prismAnalytics() modifier on your root view:
import PrismFoundation
import FirebaseAnalytics

struct FirebaseProvider: PrismAnalyticsProvider {
    func track(_ event: PrismAnalyticsEvent) {
        Analytics.logEvent(event.name, parameters: event.properties)
    }
}

// In your app entry point
ContentView()
    .prismAnalytics(FirebaseProvider())
Once set up, PrismButton, PrismTextField, PrismCarousel, PrismTabView, and PrismNavigationView automatically emit PrismAnalyticsEvent values through your provider. You can also track screens explicitly:
ContentView()
    .prismTrackScreen("Home")
The same pattern works for Amplitude, Mixpanel, or any other service — you write one adapter conforming to PrismAnalyticsProvider.
PrismIntelligence is built on Apple’s on-device ML stack and also supports remote LLM endpoints:
CapabilityFramework / backend
Tabular classification and regression trainingCreateML (MLClassifier, MLRegressor)
CoreML model inferenceCoreML
Image classificationVision (VNClassifyImageRequest)
Sentiment analysis, entity extraction, language detection, tokenizationNaturalLanguage
Vector embeddings and cosine similarity searchCustom actor (PrismEmbeddingStore)
RAG pipeline (chunk → embed → retrieve → generate)PrismRAGPipeline
Remote LLM (OpenAI-compatible APIs, etc.)HTTP via PrismNetwork
To connect to a remote LLM, use the convenience factory:
let client = PrismIntelligenceClient.remote(
    endpoint: url,
    token: "sk-...",
    model: "gpt-4o"
)
let answer = try await client.generate("Summarize this document.")
On-device training and inference run entirely on the user’s device with no data leaving the app. Remote inference sends data to the endpoint you configure.
PrismNetwork provides first-class error handling through retry policies, an offline queue, and response caching.Retry with exponential backoff:
let policy = PrismExponentialBackoff(maxAttempts: 3, baseDelay: 0.5)
let request = PrismRetryableRequest(endpoint: myEndpoint, policy: policy)
let response = try await client.send(request)
Offline queue: When the device is offline, PrismOfflineQueue stores requests with priority ordering and automatically flushes them when connectivity is restored via PrismConnectivityMonitor (backed by NWPathMonitor).Response caching: Use PrismCachePolicy to choose one of four caching strategies. PrismResponseCache manages a TTL-based LRU cache so repeated requests avoid unnecessary network round trips.Request deduplication: PrismRequestDeduplicator coalesces identical in-flight requests by URL + method + body hash, preventing redundant calls when multiple parts of your UI request the same resource simultaneously.
PrismUI components are SwiftUI View types, so they do not render natively in UIKit hierarchies. You can, however, host them inside a UIHostingController as you would any SwiftUI view:
let hostingController = UIHostingController(
    rootView: PrismButton("Confirm", variant: .filled) {
        handleConfirm()
    }
    .prismTheme(DefaultTheme())
)
The other modules (PrismArchitecture, PrismNetwork, PrismFoundation, PrismIntelligence) have no SwiftUI dependency and work in purely UIKit apps. PrismStore and PrismNetwork are plain Swift actors and can be driven from UIKit view controllers without any SwiftUI involvement.
PrismStore is a Swift actor, so you test it using async/await in Swift Testing or XCTest:
import Testing
@testable import MyApp

@Test func incrementsCounter() async {
    let store = PrismStore(
        initialState: CounterState(count: 0),
        reducer: counterReducer
    )
    await store.send(.increment)
    #expect(await store.state.count == 1)
}
For more complex scenarios, PrismDerivedStore lets you project a slice of state for focused assertions, and PrismTimeTravelDebugger records a snapshot history you can replay step by step during debugging.For visual regression testing of PrismUI components, use the built-in PrismSnapshotTest:
func testButtonAppearance() {
    let button = PrismButton("Save", variant: .filled) {}
        .prismTheme(DefaultTheme())
    PrismSnapshotTest.render(button, configuration: .light)
}
PrismSnapshotTest supports light, dark, large text, and high contrast configurations out of the box.
Yes. PrismUI includes spatial layout support targeting visionOS 26:
  • PrismVolumeView — renders content in a visionOS volume
  • PrismOrnamentView — glass ornaments attached to a window
  • prismDepth() and prismDepthStack — depth layering using PrismDepthStack
  • prismOrnament() and prismHover() — spatial interaction modifiers
The default themes render correctly in the shared space and full space on visionOS. The HighContrastTheme is particularly useful for visionOS accessibility because it passes WCAG AAA contrast ratios in all environments.
PrismUI uses buttonStyle(.glass) and .glassProminent natively on visionOS via PrismGlassContainer and the .glass button variant, so your app’s chrome feels at home in the spatial computing environment.
Use PrismTokenExport to export all six token types in JSON or Figma DTCG format:
import PrismUI

// Export as Figma Variables JSON
let json = PrismTokenExport.exportFigma(theme: DefaultTheme())

// Export as W3C DTCG format (compatible with Style Dictionary, Tokens Studio, etc.)
let dtcg = PrismFigmaSync.exportDTCG(theme: DefaultTheme())
You can also import a Figma JSON file back into a BrandTheme using PrismFigmaSync.importFigma(_:), which creates a fully populated theme from your design tool’s variable definitions. This gives you a bidirectional sync workflow between your Figma file and your Swift codebase.
Prism’s plugin architecture lets you register custom themes, token overrides, and component factories at runtime without modifying the package source:
import PrismUI

struct MyPlugin: PrismPlugin {
    var theme: (any PrismTheme)? { MyBrandTheme() }
    var colorOverrides: [ColorToken: Color] { [.brand: .purple] }
    var componentFactory: PrismComponentFactory? { MyComponentFactory() }
}

// Register the plugin at app startup
PrismPluginRegistry.shared.register(MyPlugin())

// Apply the plugin's theme with a single modifier
ContentView()
    .prismPlugin(theme: MyPlugin().theme!)
Plugins are resolved at runtime, so you can distribute them as separate Swift packages and compose multiple plugins in a single app.
No. Prism does not impose a formatter or linter on your application code. You are free to use swift-format, SwiftLint, or no formatter at all — Prism integrates cleanly regardless of your code style choices.