diff LazyBear/Views/Global Helpers/StockItem.swift @ 421:9b7af8e83d12

Change intraday prices model
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sat, 12 Jun 2021 15:20:04 +0200
parents 2984d8946342
children
line wrap: on
line diff
--- a/LazyBear/Views/Global Helpers/StockItem.swift	Fri Jun 11 13:02:18 2021 +0200
+++ b/LazyBear/Views/Global Helpers/StockItem.swift	Sat Jun 12 15:20:04 2021 +0200
@@ -15,7 +15,7 @@
 struct StockItem: View {
     var symbol: String
     var company: QuoteModel
-    var intradayPrices: [IntradayPriceModel]?
+    var intradayPrices: [Double]?
     var orientation: OrientationView
     var hidePriceView: Bool?
     
@@ -43,7 +43,7 @@
     static var previews: some View {
         StockItem(
             symbol: "AAPL", company: QuoteModel(changePercent: 0.03, companyName: "apple inc", latestPrice: 130.3),
-            intradayPrices: [IntradayPriceModel(open: 130.3), IntradayPriceModel(open: 132.3)], orientation: .horizontal
+            intradayPrices: [130.3, 132.3], orientation: .horizontal
         )
     }
 }
@@ -52,7 +52,7 @@
 struct VerticalStockRow: View {
     var symbol: String
     var company: QuoteModel
-    var intradayPrices: [IntradayPriceModel]?
+    var intradayPrices: [Double]?
     
     var body: some View {
         RoundedRectangle(cornerRadius: 20)
@@ -93,7 +93,7 @@
                     
                     Spacer()
                      
-                    if let prices = intradayPrices?.compactMap { $0.open } {
+                    if let prices = intradayPrices {
                         LineChartView(data: prices, dates: nil, hours: nil, dragGesture: false)
                             .padding(.vertical)
                             .clipShape(RoundedRectangle(cornerRadius: 20))
@@ -109,7 +109,7 @@
 struct HorizontalStockRow: View {
     var symbol: String
     var company: QuoteModel
-    var intradayPrices: [IntradayPriceModel]?
+    var intradayPrices: [Double]?
     var hidePriceView: Bool
     
     var body: some View {
@@ -127,7 +127,7 @@
             
             Spacer()
             if !hidePriceView {
-                if let prices = intradayPrices?.compactMap { $0.open } {
+                if let prices = intradayPrices {
                     LineChartView(data: prices, dates: nil, hours: nil, dragGesture: false)
                         .frame(width: 80)
                         .padding(.vertical, 10)