Mercurial > public > stock-charts
comparison Sources/InteractiveCharts/UI Previews/ChartViewPreview.swift @ 14:edf2bfcd8d97
Reorganise structure
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Wed, 28 Apr 2021 19:01:40 +0200 |
parents | InteractiveCharts/UI Previews/ChartViewPreview.swift@a9690565726b |
children |
comparison
equal
deleted
inserted
replaced
13:fdab6510dc46 | 14:edf2bfcd8d97 |
---|---|
1 // | |
2 // ChartViewPreview.swift | |
3 // InteractiveCharts | |
4 // | |
5 // Created by Dennis Concepción Martín on 26/4/21. | |
6 // | |
7 | |
8 import SwiftUI | |
9 | |
10 struct ChartViewPreview: View { | |
11 var data: [Double] | |
12 var dates: [String]? | |
13 var hours: [String]? | |
14 | |
15 var range = ["5D", "1M", "3M", "1Y", "5Y"] | |
16 @State private var selectedRange = "3M" | |
17 | |
18 var body: some View { | |
19 NavigationView { | |
20 VStack(alignment: .leading) { | |
21 Text("Apple Inc") | |
22 .font(.title3) | |
23 .padding([.horizontal, .bottom]) | |
24 | |
25 Picker("Select a range", selection: $selectedRange) { | |
26 ForEach(range, id: \.self) { | |
27 Text($0) | |
28 } | |
29 } | |
30 .pickerStyle(SegmentedPickerStyle()) | |
31 .padding(.horizontal) | |
32 | |
33 ChartView(data: data, dates: dates, hours: hours) | |
34 .padding(.vertical) | |
35 } | |
36 .navigationTitle("AAPL") | |
37 .toolbar { | |
38 ToolbarItem(placement: .navigationBarTrailing) { | |
39 Button(action: {}) { | |
40 Image(systemName: "star") | |
41 } | |
42 } | |
43 | |
44 ToolbarItem(placement: .navigationBarLeading) { | |
45 Button(action: {}) { | |
46 Image(systemName: "plus.circle") | |
47 } | |
48 } | |
49 } | |
50 } | |
51 .navigationViewStyle(StackNavigationViewStyle()) | |
52 } | |
53 } |