Mercurial > public > stock-charts
view Sources/StockCharts/CapsuleChart/CapsuleChartView.swift @ 109:957989b1068d
Fixes GeometryReader alignment
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sun, 04 Jul 2021 16:48:55 +0100 |
parents | f53d8b9ca92b |
children | b4901499ad40 |
line wrap: on
line source
// // CapsuleChartView.swift // StockCharts // // Created by Dennis Concepción Martín on 5/6/21. // import SwiftUI public struct CapsuleChartView: View { public var percentageOfWidth: CGFloat public var style: CapsuleChartStyle public init(percentageOfWidth: CGFloat, style: CapsuleChartStyle) { self.percentageOfWidth = percentageOfWidth self.style = style } public var body: some View { GeometryReader { proxy in ZStack { Group { Capsule() .foregroundColor(Color.gray) .opacity(0.2) Capsule() .foregroundColor(style.capsuleColor) .frame(width: proxy.size.width * percentageOfWidth) } .frame(height: 10) } } } }