changeset 90:d5dc68b6d459

Merge pull request #8 from denniscm190/dennis Implement CapsuleChartView committer: GitHub <noreply@github.com>
author Dennis C. M. <dennis@denniscm.com>
date Sat, 05 Jun 2021 18:50:36 +0200
parents 455e3bcdb510 (current diff) 3e94c6721a6a (diff)
children b9aa9d7b030d 5b9859e47d3c
files
diffstat 3 files changed, 45 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Sources/StockCharts/CapsuleChart/CapsuleChartView.swift	Sat Jun 05 18:50:36 2021 +0200
@@ -0,0 +1,32 @@
+//
+//  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 init(percentageOfWidth: CGFloat) {
+        self.percentageOfWidth = percentageOfWidth
+    }
+    public var body: some View {
+        ZStack {
+            GeometryReader { proxy in
+                Group {
+                    Capsule()
+                        .foregroundColor(Color(.systemGray))
+                        .opacity(0.2)
+                    
+                    Capsule()
+                        .foregroundColor(Color(.systemBlue))
+                        .frame(width: proxy.size.width * percentageOfWidth)
+                }
+                .frame(height: 10)
+            }
+        }
+    }
+}
--- a/StockCharts.xcodeproj/project.pbxproj	Wed May 26 22:30:20 2021 +0200
+++ b/StockCharts.xcodeproj/project.pbxproj	Sat Jun 05 18:50:36 2021 +0200
@@ -7,6 +7,7 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		950857AE266BDF62005357BA /* CapsuleChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 950857AD266BDF62005357BA /* CapsuleChartView.swift */; };
 		95770B8B263C57B5003FA924 /* StockCharts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95770B81263C57B5003FA924 /* StockCharts.framework */; };
 		95770B90263C57B5003FA924 /* StockChartsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770B8F263C57B5003FA924 /* StockChartsTests.swift */; };
 		95770B92263C57B5003FA924 /* StockCharts.h in Headers */ = {isa = PBXBuildFile; fileRef = 95770B84263C57B5003FA924 /* StockCharts.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -28,6 +29,7 @@
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXFileReference section */
+		950857AD266BDF62005357BA /* CapsuleChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CapsuleChartView.swift; sourceTree = "<group>"; };
 		95770B81263C57B5003FA924 /* StockCharts.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = StockCharts.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		95770B84263C57B5003FA924 /* StockCharts.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StockCharts.h; sourceTree = "<group>"; };
 		95770B85263C57B5003FA924 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -63,6 +65,14 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
+		950857AC266BDF48005357BA /* CapsuleChart */ = {
+			isa = PBXGroup;
+			children = (
+				950857AD266BDF62005357BA /* CapsuleChartView.swift */,
+			);
+			path = CapsuleChart;
+			sourceTree = "<group>";
+		};
 		95770B77263C57B5003FA924 = {
 			isa = PBXGroup;
 			children = (
@@ -88,8 +98,9 @@
 		95770B83263C57B5003FA924 /* StockCharts */ = {
 			isa = PBXGroup;
 			children = (
+				95770B84263C57B5003FA924 /* StockCharts.h */,
 				95770B9E263C58F4003FA924 /* LineChart */,
-				95770B84263C57B5003FA924 /* StockCharts.h */,
+				950857AC266BDF48005357BA /* CapsuleChart */,
 			);
 			path = StockCharts;
 			sourceTree = "<group>";
@@ -251,6 +262,7 @@
 				95770BA0263C590C003FA924 /* LineChartView.swift in Sources */,
 				95770BA3263C5934003FA924 /* ChartLabel.swift in Sources */,
 				95770BA7263C596E003FA924 /* LinePath.swift in Sources */,
+				950857AE266BDF62005357BA /* CapsuleChartView.swift in Sources */,
 				95770BA9263C5988003FA924 /* LineView.swift in Sources */,
 				95770BA5263C594C003FA924 /* IndicatorPoint.swift in Sources */,
 			);
Binary file StockCharts.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed