← Back to Discover

CandleKit

CandleKit is a SwiftUI package that draws interactive candlestick charts like those in a trading app.

Libraries & SDKs

What it does

CandleKit provides a CandlestickChart SwiftUI view. The view takes an array of price bars. Add the package in Xcode through File > Add Package Dependencies, or declare it in Package.swift and add CandleKit to your target's dependencies. Modifiers configure the chart. For example, .indicators([.sma(20), .ema(50)]) adds a 20-period simple moving average and a 50-period exponential moving average, and volume bars appear underneath. The chart is a plain SwiftUI View. It needs no UIViewControllerRepresentable and no delegate protocols. CandleKit requires iOS 17 or later and Swift 6. CandleSampleData.randomWalk(count:) from CandleKitCore generates a deterministic fake price series.

Capabilities

  • Drag to scroll with momentum, pinch to zoom around your fingers, long-press for a crosshair, and double-tap to reset.
  • The chart adapts automatically to dark mode, Dynamic Type and VoiceOver.
  • Built-in technical indicators include moving averages, RSI, MACD and Bollinger Bands.
  • Drawing tools include trend lines, Fibonacci retracements and rectangles.
  • The CandleKitCore target provides indicator, scale and viewport math as pure Foundation without SwiftUI, and it builds on Linux.

When to use it

  • You need a candlestick chart in an iOS app like the ones in a trading app.
  • You want technical indicators and trader drawing tools on a chart.
  • You want to scroll, zoom and use a crosshair on a candlestick chart through drag, pinch and long-press gestures.