What's New

Minor UI improvements

2021-07-17T11:27:26Z

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

SwiftUI Stock Charts

Build Status
Display interactive stock charts easily 🎉

View1-Screenshot

Instalation

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

Usage

import StockCharts

Line chart

LineChartView(data: [Double], dates: [String]?, hours: [String]?, dragGesture: Bool?)
data: [120.3, 121.0, 132.4, ...]
dates: ["yyyy-MM-dd", "2021-01-01", "2021-01-02", ...]
hours: ["10:20", "10:21", "10:22", ...]  // It could be any format
dragGesture: false  // By default is 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)
                        .padding(.top)
                }
                .padding()
            )
    }
}

CapsuleChart

Description

  • Swift Tools 5.3.0

Dependencies

  • None
Last updated: Mon Jul 26 2021 09:19:13 GMT-0500 (GMT-05:00)