Mercurial > public > stock-charts
diff Sources/StockCharts/CapsuleChart/CapsuleChartView.swift @ 108:f53d8b9ca92b
Custom style implemented
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sun, 04 Jul 2021 16:40:24 +0100 |
parents | 0c0d38dca6d8 |
children | 957989b1068d |
line wrap: on
line diff
--- a/Sources/StockCharts/CapsuleChart/CapsuleChartView.swift Mon Jun 28 14:01:13 2021 +0200 +++ b/Sources/StockCharts/CapsuleChart/CapsuleChartView.swift Sun Jul 04 16:40:24 2021 +0100 @@ -9,10 +9,13 @@ public struct CapsuleChartView: View { public var percentageOfWidth: CGFloat + public var style: CapsuleChartStyle - public init(percentageOfWidth: CGFloat) { + public init(percentageOfWidth: CGFloat, style: CapsuleChartStyle) { self.percentageOfWidth = percentageOfWidth + self.style = style } + public var body: some View { ZStack { GeometryReader { proxy in @@ -22,7 +25,7 @@ .opacity(0.2) Capsule() - .foregroundColor(Color.blue) + .foregroundColor(style.capsuleColor) .frame(width: proxy.size.width * percentageOfWidth) } .frame(height: 10)