Swiftpack.co - denniscmartin/stock-charts as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by denniscmartin.
denniscmartin/stock-charts v1.1
🎉 SwiftUI stock charts for iOS
⭐️ 95
🕓 1 year ago
iOS watchOS
.package(url: "https://github.com/denniscmartin/stock-charts.git", from: "v1.1")

StockCharts for SwiftUI - Display interactive stock charts easily 🎉 | Product Hunt

SwiftUI Stock Charts

Build Status
This package is deprecated, please see Swift Charts

Display interactive stock charts easily 🎉


  • In Xcode go to File -> Swift packages -> Add package dependency
  • Copy and paste https://github.com/denniscm190/StockCharts.git

Demo app

Trades is a SwiftUI app with real use cases of the StockCharts framework.


import StockCharts

Line chart

let lineChartController = LineChartController(prices: [Double])
LineChartView(lineChartController: lineChartController)

You can customise the line chart with LineChartController

    prices: [Double],
    dates: [String]?, // format: yy-MM-dd
    hours: [String]?, // has to correspond to dates
    labelColor: Color,
    indicatorPointColor: Color,
    showingIndicatorLineColor: Color,
    flatTrendLineColor: Color,
    uptrendLineColor: Color,
    downtrendLineColor: Color,
    dragGesture: Bool

To enable the drag gesture set dragGesture to true in the LineChartController

            prices: [Double],
            dragGesture: true

Capsule chart

CapsuleChartView(percentageOfWidth: CGFloat)
// percentageOfWidth: must be 0 <= x <= 1


import SwiftUI
import StockCharts

struct ContentView: View {
    var body: some View {
        RoundedRectangle(cornerRadius: 25)
            .frame(width: 400, height: 120)
            .shadow(color: Color(.gray).opacity(0.15), radius: 10)
                VStack(alignment: .leading) {
                    Text("Dennis Concepcion")
                    Text("Random guy")
                    CapsuleChartView(percentageOfWidth: 0.6, style: CapsuleChartStyle(capsuleColor: Color.blue))


Stars: 95
Last commit: 25 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Version 1.2.9
1 year ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics