comparison LazyBear/Views/Global Helpers/StockItem.swift @ 396:bd34e16b01ad

Add StockCharts package
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sat, 08 May 2021 19:19:17 +0200
parents 6303385b3629
children 933546fa5651
comparison
equal deleted inserted replaced
395:a0cf8fe47044 396:bd34e16b01ad
4 // 4 //
5 // Created by Dennis Concepción Martín on 28/3/21. 5 // Created by Dennis Concepción Martín on 28/3/21.
6 // 6 //
7 7
8 import SwiftUI 8 import SwiftUI
9 import StockCharts
9 10
10 enum OrientationView { 11 enum OrientationView {
11 case horizontal, vertical 12 case horizontal, vertical
12 } 13 }
13 14
67 .padding(.horizontal) 68 .padding(.horizontal)
68 69
69 Spacer() 70 Spacer()
70 71
71 if let prices = intradayPrices?.compactMap { $0.open } { 72 if let prices = intradayPrices?.compactMap { $0.open } {
72 LineView(data: prices) 73 LineChartView(data: prices, dates: nil, hours: nil, dragGesture: false)
73 .foregroundColor(company.changePercent ?? 0 < 0 ? .red: .green)
74 .padding(.vertical) 74 .padding(.vertical)
75 .clipped() 75 .clipShape(RoundedRectangle(cornerRadius: 20))
76 } 76 }
77 77
78 } 78 }
79 ,alignment: .leading 79 ,alignment: .leading
80 ) 80 )
102 } 102 }
103 103
104 Spacer() 104 Spacer()
105 if !hidePriceView { 105 if !hidePriceView {
106 if let prices = intradayPrices?.compactMap { $0.open } { 106 if let prices = intradayPrices?.compactMap { $0.open } {
107 LineView(data: prices) 107 LineChartView(data: prices, dates: nil, hours: nil, dragGesture: false)
108 .foregroundColor(company.changePercent ?? 0 < 0 ? .red: .green)
109 .frame(width: 80) 108 .frame(width: 80)
110 .padding(.vertical, 10) 109 .padding(.vertical, 10)
111 .padding(.leading) 110 .padding(.leading)
112 } 111 }
113 112