Mercurial > public > stock-charts
changeset 63:fdc4db7f23de 0.0.1 0.0.2 1.0.0 1.1.0 v1.1
Merge pull request #5 from denniscm190/denniscm190
Denniscm190
committer: GitHub <noreply@github.com>
author | Dennis C. M. <dennis@denniscm.com> |
---|---|
date | Fri, 07 May 2021 12:28:56 +0200 |
parents | e54c96a5c652 (current diff) a2daff375b43 (diff) |
children | d8076ee78a96 |
files | Sources/StockCharts/LineChart/LineChartView.swift |
diffstat | 14 files changed, 74 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
Binary file .swiftpm/xcode/package.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.swiftpm/xcode/xcuserdata/dennis.xcuserdatad/xcschemes/xcschememanagement.plist Fri May 07 12:28:56 2021 +0200 @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>SchemeUserState</key> + <dict> + <key>StockCharts.xcscheme_^#shared#^_</key> + <dict> + <key>orderHint</key> + <integer>0</integer> + </dict> + </dict> +</dict> +</plist>
--- a/DemoProject/DemoProject.xcodeproj/project.pbxproj Mon May 03 17:51:39 2021 +0200 +++ b/DemoProject/DemoProject.xcodeproj/project.pbxproj Fri May 07 12:28:56 2021 +0200 @@ -7,12 +7,12 @@ objects = { /* Begin PBXBuildFile section */ + 9553737B26454C37003BDDEC /* StockCharts in Frameworks */ = {isa = PBXBuildFile; productRef = 9553737A26454C37003BDDEC /* StockCharts */; }; 95770BDF263C5F85003FA924 /* DemoProjectApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BDE263C5F85003FA924 /* DemoProjectApp.swift */; }; 95770BE1263C5F85003FA924 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BE0263C5F85003FA924 /* ContentView.swift */; }; 95770BE3263C5F86003FA924 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95770BE2263C5F86003FA924 /* Assets.xcassets */; }; 95770BE6263C5F86003FA924 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 95770BE5263C5F86003FA924 /* Preview Assets.xcassets */; }; 95770BEE263C5FCD003FA924 /* View1.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BED263C5FCD003FA924 /* View1.swift */; }; - 9584AA90264048AD00626769 /* StockCharts in Frameworks */ = {isa = PBXBuildFile; productRef = 9584AA8F264048AD00626769 /* StockCharts */; }; 9584AA92264048D700626769 /* View2.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9584AA91264048D700626769 /* View2.swift */; }; /* End PBXBuildFile section */ @@ -32,7 +32,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9584AA90264048AD00626769 /* StockCharts in Frameworks */, + 9553737B26454C37003BDDEC /* StockCharts in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -94,7 +94,7 @@ ); name = DemoProject; packageProductDependencies = ( - 9584AA8F264048AD00626769 /* StockCharts */, + 9553737A26454C37003BDDEC /* StockCharts */, ); productName = DemoProject; productReference = 95770BDB263C5F85003FA924 /* DemoProject.app */; @@ -124,7 +124,7 @@ ); mainGroup = 95770BD2263C5F85003FA924; packageReferences = ( - 9584AA8E264048AD00626769 /* XCRemoteSwiftPackageReference "StockCharts" */, + 9553737926454C37003BDDEC /* XCRemoteSwiftPackageReference "StockCharts" */, ); productRefGroup = 95770BDC263C5F85003FA924 /* Products */; projectDirPath = ""; @@ -346,20 +346,20 @@ /* End XCConfigurationList section */ /* Begin XCRemoteSwiftPackageReference section */ - 9584AA8E264048AD00626769 /* XCRemoteSwiftPackageReference "StockCharts" */ = { + 9553737926454C37003BDDEC /* XCRemoteSwiftPackageReference "StockCharts" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/denniscm190/StockCharts.git"; requirement = { - branch = main; + branch = denniscm190; kind = branch; }; }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ - 9584AA8F264048AD00626769 /* StockCharts */ = { + 9553737A26454C37003BDDEC /* StockCharts */ = { isa = XCSwiftPackageProductDependency; - package = 9584AA8E264048AD00626769 /* XCRemoteSwiftPackageReference "StockCharts" */; + package = 9553737926454C37003BDDEC /* XCRemoteSwiftPackageReference "StockCharts" */; productName = StockCharts; }; /* End XCSwiftPackageProductDependency section */
--- a/DemoProject/DemoProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Mon May 03 17:51:39 2021 +0200 +++ b/DemoProject/DemoProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Fri May 07 12:28:56 2021 +0200 @@ -5,8 +5,8 @@ "package": "StockCharts", "repositoryURL": "https://github.com/denniscm190/StockCharts.git", "state": { - "branch": "main", - "revision": "63798e38d49dfd38625aae730b6d062fbc6288f2", + "branch": "denniscm190", + "revision": "838eb395f952ad7271e53429f7cd91fb21c84108", "version": null } }
Binary file DemoProject/DemoProject.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/DemoProject/DemoProject/View1.swift Mon May 03 17:51:39 2021 +0200 +++ b/DemoProject/DemoProject/View1.swift Fri May 07 12:28:56 2021 +0200 @@ -12,6 +12,7 @@ var data: [Double] var dates: [String]? var hours: [String]? + var dragGesture: Bool? var range = ["5D", "1M", "3M", "1Y", "5Y"] @State private var selectedRange = "3M" @@ -31,7 +32,7 @@ .pickerStyle(SegmentedPickerStyle()) .padding(.horizontal) - ChartView(data: data, dates: dates, hours: hours) + LineChartView(data: data, dates: dates, hours: hours, dragGesture: dragGesture) .padding(.vertical) List(1..<7) { i in
--- a/DemoProject/DemoProject/View2.swift Mon May 03 17:51:39 2021 +0200 +++ b/DemoProject/DemoProject/View2.swift Fri May 07 12:28:56 2021 +0200 @@ -54,7 +54,7 @@ } .padding(.leading) - ChartView(data: data, dates: nil, hours: nil) + LineChartView(data: data, dates: nil, hours: nil, dragGesture: false) .padding(.bottom) .clipShape(RoundedRectangle(cornerRadius: 15)) }
--- a/README.md Mon May 03 17:51:39 2021 +0200 +++ b/README.md Fri May 07 12:28:56 2021 +0200 @@ -26,7 +26,7 @@ ### Line chart ```swift -ChartView(data: [Double], dates: [String]?, hours: [String]?) +LineChartView(data: [Double], dates: [String]?, hours: [String]?, dragGesture: Bool?) ``` #### Arguments @@ -34,5 +34,6 @@ 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 ``` <img width="374" alt="LineChartVideo" src="https://user-images.githubusercontent.com/66180929/116899623-137c6e80-ac38-11eb-8ec0-e678aea54062.gif">
--- a/Sources/StockCharts/Info.plist Mon May 03 17:51:39 2021 +0200 +++ b/Sources/StockCharts/Info.plist Fri May 07 12:28:56 2021 +0200 @@ -15,7 +15,7 @@ <key>CFBundlePackageType</key> <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> <key>CFBundleShortVersionString</key> - <string>1.0</string> + <string>$(MARKETING_VERSION)</string> <key>CFBundleVersion</key> <string>$(CURRENT_PROJECT_VERSION)</string> </dict>
--- a/Sources/StockCharts/LineChart/ChartView.swift Mon May 03 17:51:39 2021 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -// -// ChartView.swift -// StockCharts -// -// Created by Dennis Concepción Martín on 30/4/21. -// - -import SwiftUI - -public struct ChartView: View { - public var data: [Double] - public var dates: [String]? - public var hours: [String]? - - @State var showingIndicators = false - @State var indexPosition = Int() - - public init(data: [Double], dates: [String]?, hours: [String]?) { - self.data = data - self.dates = dates - self.hours = hours - } - - public var body: some View { - VStack { - ChartLabel(data: data, dates: dates, hours: hours, indexPosition: $indexPosition) - .opacity(showingIndicators ? 1: 0) - .padding(.vertical) - - LineView(data: data, showingIndicators: $showingIndicators, indexPosition: $indexPosition) - } - } -}
--- a/Sources/StockCharts/LineChart/Helpers/LineView.swift Mon May 03 17:51:39 2021 +0200 +++ b/Sources/StockCharts/LineChart/Helpers/LineView.swift Fri May 07 12:28:56 2021 +0200 @@ -11,6 +11,7 @@ public var data: [Double] public var dates: [String]? public var hours: [String]? + public var dragGesture: Bool? @Binding var showingIndicators: Bool @Binding var indexPosition: Int @@ -32,7 +33,7 @@ .rotationEffect(.degrees(180), anchor: .center) .rotation3DEffect(.degrees(180), axis: (x: 0.0, y: 1.0, z: 0.0)) .contentShape(Rectangle()) // Control tappable area - .gesture( + .gesture(dragGesture ?? true ? LongPressGesture(minimumDuration: 0.2) .sequenced(before: DragGesture(minimumDistance: 0, coordinateSpace: .local)) .onChanged({ value in // Get value of the gesture @@ -49,6 +50,7 @@ .onEnded({ value in self.showingIndicators = false }) + : nil // On dragGesture = false ) }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Sources/StockCharts/LineChart/LineChartView.swift Fri May 07 12:28:56 2021 +0200 @@ -0,0 +1,35 @@ +// +// LineChartView.swift +// StockCharts +// +// Created by Dennis Concepción Martín on 30/4/21. +// + +import SwiftUI + +public struct LineChartView: View { + public var data: [Double] + public var dates: [String]? + public var hours: [String]? + public var dragGesture: Bool? + + @State var showingIndicators = false + @State var indexPosition = Int() + + public init(data: [Double], dates: [String]?, hours: [String]?, dragGesture: Bool?) { + self.data = data + self.dates = dates + self.hours = hours + self.dragGesture = dragGesture + } + + public var body: some View { + VStack { + ChartLabel(data: data, dates: dates, hours: hours, indexPosition: $indexPosition) + .opacity(showingIndicators ? 1: 0) + .padding(.vertical) + + LineView(data: data, dates: dates, hours: hours, dragGesture: dragGesture, showingIndicators: $showingIndicators, indexPosition: $indexPosition) + } + } +}
--- a/StockCharts.xcodeproj/project.pbxproj Mon May 03 17:51:39 2021 +0200 +++ b/StockCharts.xcodeproj/project.pbxproj Fri May 07 12:28:56 2021 +0200 @@ -10,7 +10,7 @@ 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, ); }; }; - 95770BA0263C590C003FA924 /* ChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770B9F263C590C003FA924 /* ChartView.swift */; }; + 95770BA0263C590C003FA924 /* LineChartView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770B9F263C590C003FA924 /* LineChartView.swift */; }; 95770BA3263C5934003FA924 /* ChartLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BA2263C5934003FA924 /* ChartLabel.swift */; }; 95770BA5263C594C003FA924 /* IndicatorPoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BA4263C594C003FA924 /* IndicatorPoint.swift */; }; 95770BA7263C596E003FA924 /* LinePath.swift in Sources */ = {isa = PBXBuildFile; fileRef = 95770BA6263C596E003FA924 /* LinePath.swift */; }; @@ -35,7 +35,7 @@ 95770B8F263C57B5003FA924 /* StockChartsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StockChartsTests.swift; sourceTree = "<group>"; }; 95770B91263C57B5003FA924 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 95770B9D263C58B1003FA924 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; }; - 95770B9F263C590C003FA924 /* ChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartView.swift; sourceTree = "<group>"; }; + 95770B9F263C590C003FA924 /* LineChartView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineChartView.swift; sourceTree = "<group>"; }; 95770BA2263C5934003FA924 /* ChartLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChartLabel.swift; sourceTree = "<group>"; }; 95770BA4263C594C003FA924 /* IndicatorPoint.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IndicatorPoint.swift; sourceTree = "<group>"; }; 95770BA6263C596E003FA924 /* LinePath.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinePath.swift; sourceTree = "<group>"; }; @@ -122,7 +122,7 @@ 95770B9E263C58F4003FA924 /* LineChart */ = { isa = PBXGroup; children = ( - 95770B9F263C590C003FA924 /* ChartView.swift */, + 95770B9F263C590C003FA924 /* LineChartView.swift */, 95770BA1263C5927003FA924 /* Helpers */, ); path = LineChart; @@ -248,7 +248,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 95770BA0263C590C003FA924 /* ChartView.swift in Sources */, + 95770BA0263C590C003FA924 /* LineChartView.swift in Sources */, 95770BA3263C5934003FA924 /* ChartLabel.swift in Sources */, 95770BA7263C596E003FA924 /* LinePath.swift in Sources */, 95770BA9263C5988003FA924 /* LineView.swift in Sources */, @@ -414,6 +414,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MARKETING_VERSION = 1.1; PRODUCT_BUNDLE_IDENTIFIER = io.dennistech.StockCharts; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES; @@ -441,6 +442,7 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); + MARKETING_VERSION = 1.1; PRODUCT_BUNDLE_IDENTIFIER = io.dennistech.StockCharts; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; SKIP_INSTALL = YES;