Installation & Requirements
Relevant source files
The following files were used as context for generating this wiki page:
SwiftDitherKit is a dependency-free library for SwiftUI that provides native charts rendered using ordered-dither textures. It is designed to work across the Apple ecosystem, providing area, line, bar, pie, donut, radar, and sparkline views.
Sources: README.md:3-6, Sources/SwiftDitherKit/SwiftDitherKit.docc/SwiftDitherKit.md:1-5
Platform and Software Requirements
The library requires modern Apple platforms and Swift 6.0 features to handle asynchronous rendering and dithered image caching.
| Requirement | Minimum Version |
|---|---|
| Swift | 6.0+ |
| iOS | 17 |
| macOS | 14 |
| tvOS | 17 |
| visionOS | 1 |
Sources: README.md:10-14, Package.swift:5-10
Installation Methods
SwiftDitherKit can be integrated into a project via Xcode or as a dependency in a Package.swift file.
Swift Package Manager (Xcode)
To add the package in Xcode, use the repository URL:
`https://github.com/MarkUnthank/SwiftDitherKit.git%60
Sources: README.md:16-20
Manual Package Integration
Add the following entry to your Package.swift dependencies array:
dependencies: [
.package(
url: "https://github.com/MarkUnthank/SwiftDitherKit.git%22%2C
from: "0.1.0"
)
]
Sources: README.md:22-29
Development Environment Setup
The repository includes a suite of tools for local development, including linting and a specialized snapshot tool for rendering the chart gallery.
The snapshot command uses SwiftUI's macOS ImageRenderer to generate visual documentation without requiring an iOS simulator.
Sources: README.md:118-126, Sources/DitherKitSnapshot/main.swift:10-25
Dependency Architecture
SwiftDitherKit is structured to have no runtime dependencies, ensuring high portability and low overhead.
Sources: Package.swift:16-32
Offscreen Rendering Requirements
When using ImageRenderer or other offscreen rendering tools, standard asynchronous view tasks may not execute. In these scenarios, the subtree must be opted into immediate rendering to ensure pixels are available during view evaluation.
let renderer = ImageRenderer(
content: MyChart()
.ditherRenderingMode(.immediate)
)
Sources: README.md:128-132, Sources/SwiftDitherKit/SwiftDitherKit.docc/GettingStarted.md:46-55
Licensing and Attribution
The project is distributed under the MIT License. It is based on Dither Kit and credits Evil Charts as a visual inspiration.
Sources: THIRD_PARTY_NOTICES.md:3-11
SwiftDitherKit provides a robust, native charting solution for SwiftUI with minimal setup, requiring only modern Apple OS versions and the Swift 6.0 compiler. By following the standard SPM installation process and configuring offscreen rendering modes where necessary, developers can quickly integrate high-performance dithered charts into their applications.