Swiftpack.co -  denniscm190/stock-charts as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
denniscm190/stock-charts
๐ŸŽ‰ SwiftUI stock charts for iOS
.package(url: "https://github.com/denniscm190/stock-charts.git", from: "v1.1")

StockCharts for SwiftUI - Display interactive stock charts easily ๐ŸŽ‰ | Product Hunt

SwiftUI Stock Charts

Build Status
Display interactive stock charts easily ๐ŸŽ‰

Instalation

  • 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.

Usage

import StockCharts

Line chart

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

You can customise the line chart with LineChartController

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

LineChartView(
    lineChartController:
        LineChartController(
            prices: [Double],
            dragGesture: true
        )
)
LineChartVideo

Capsule chart

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

Example

import SwiftUI
import StockCharts

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

GitHub

link
Stars: 52
Last commit: 3 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jackโ€™d and SCRUFF. We are two of the worldโ€™s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

Version 1.2.9
6 weeks ago

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