Mercurial > public > stock-charts
changeset 32:8c544ff53df8
Access level bug fixed
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Fri, 30 Apr 2021 18:16:47 +0200 |
parents | 48fe101fd122 |
children | 9cae3f0a641b |
files | DemoProject/DemoProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved DemoProject/DemoProject.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate DemoProject/DemoProject/ContentView.swift DemoProject/DemoProject/Home.swift StockCharts.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate |
diffstat | 5 files changed, 48 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/DemoProject/DemoProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Fri Apr 30 18:11:01 2021 +0200 +++ b/DemoProject/DemoProject.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved Fri Apr 30 18:16:47 2021 +0200 @@ -6,7 +6,7 @@ "repositoryURL": "https://github.com/denniscm190/StockCharts.git", "state": { "branch": "main", - "revision": "0ef4377c88d6a5a78f4f553efd33c03ab4537941", + "revision": "63798e38d49dfd38625aae730b6d062fbc6288f2", "version": null } }
Binary file DemoProject/DemoProject.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/DemoProject/DemoProject/ContentView.swift Fri Apr 30 18:11:01 2021 +0200 +++ b/DemoProject/DemoProject/ContentView.swift Fri Apr 30 18:16:47 2021 +0200 @@ -6,15 +6,13 @@ // import SwiftUI -import StockCharts struct ContentView: View { var body: some View { TabView { -// Text("Hello world") -// ChartViewPreview(data: generateSampleData(350)) + Home(data: generateSampleData(500)) .tabItem { - Label("ChartView", systemImage: "house") + Label("Line chart", systemImage: "chart.bar.xaxis") } } }
--- a/DemoProject/DemoProject/Home.swift Fri Apr 30 18:11:01 2021 +0200 +++ b/DemoProject/DemoProject/Home.swift Fri Apr 30 18:16:47 2021 +0200 @@ -6,54 +6,49 @@ // import SwiftUI +import StockCharts -//struct Home: View { -// var data: [Double] -// var dates: [String]? -// var hours: [String]? -// -// var range = ["5D", "1M", "3M", "1Y", "5Y"] -// @State private var selectedRange = "3M" -// -// var body: some View { -// NavigationView { -// VStack(alignment: .leading) { -// Text("Apple Inc") -// .font(.title3) -// .padding([.horizontal, .bottom]) -// -// Picker("Select a range", selection: $selectedRange) { -// ForEach(range, id: \.self) { -// Text($0) -// } -// } -// .pickerStyle(SegmentedPickerStyle()) -// .padding(.horizontal) -// -// ChartView(data: data, dates: dates, hours: hours) -// .padding(.vertical) -// } -// .navigationTitle("AAPL") -// .toolbar { -// ToolbarItem(placement: .navigationBarTrailing) { -// Button(action: {}) { -// Image(systemName: "star") -// } -// } -// -// ToolbarItem(placement: .navigationBarLeading) { -// Button(action: {}) { -// Image(systemName: "plus.circle") -// } -// } -// } -// } -// .navigationViewStyle(StackNavigationViewStyle()) -// } -//} -// -//struct Home_Previews: PreviewProvider { -// static var previews: some View { -// Home() -// } -//} +struct Home: View { + var data: [Double] + var dates: [String]? + var hours: [String]? + + var range = ["5D", "1M", "3M", "1Y", "5Y"] + @State private var selectedRange = "3M" + + var body: some View { + NavigationView { + VStack(alignment: .leading) { + Text("Apple Inc") + .font(.title3) + .padding([.horizontal, .bottom]) + + Picker("Select a range", selection: $selectedRange) { + ForEach(range, id: \.self) { + Text($0) + } + } + .pickerStyle(SegmentedPickerStyle()) + .padding(.horizontal) + + ChartView(data: data, dates: dates, hours: hours) + .padding(.vertical) + } + .navigationTitle("AAPL") + .toolbar { + ToolbarItem(placement: .navigationBarTrailing) { + Button(action: {}) { + Image(systemName: "star") + } + } + + ToolbarItem(placement: .navigationBarLeading) { + Button(action: {}) { + Image(systemName: "plus.circle") + } + } + } + } + .navigationViewStyle(StackNavigationViewStyle()) + } +}