Mercurial > public > stock-charts
comparison Sources/StockCharts/CapsuleChart/CapsuleChartView.swift @ 89:3e94c6721a6a
Implement CapsuleChartView
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Sat, 05 Jun 2021 18:43:52 +0200 |
parents | |
children | 766a1169564b |
comparison
equal
deleted
inserted
replaced
88:455e3bcdb510 | 89:3e94c6721a6a |
---|---|
1 // | |
2 // CapsuleChartView.swift | |
3 // StockCharts | |
4 // | |
5 // Created by Dennis Concepción Martín on 5/6/21. | |
6 // | |
7 | |
8 import SwiftUI | |
9 | |
10 public struct CapsuleChartView: View { | |
11 public var percentageOfWidth: CGFloat | |
12 | |
13 public init(percentageOfWidth: CGFloat) { | |
14 self.percentageOfWidth = percentageOfWidth | |
15 } | |
16 public var body: some View { | |
17 ZStack { | |
18 GeometryReader { proxy in | |
19 Group { | |
20 Capsule() | |
21 .foregroundColor(Color(.systemGray)) | |
22 .opacity(0.2) | |
23 | |
24 Capsule() | |
25 .foregroundColor(Color(.systemBlue)) | |
26 .frame(width: proxy.size.width * percentageOfWidth) | |
27 } | |
28 .frame(height: 10) | |
29 } | |
30 } | |
31 } | |
32 } |