diff LazyBear/Views/Global Helpers/StockItem.swift @ 402:8357b101df67

Implementing CompanyView in NavigationLinks
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Fri, 21 May 2021 23:39:40 +0200
parents 933546fa5651
children 2984d8946342
line wrap: on
line diff
--- a/LazyBear/Views/Global Helpers/StockItem.swift	Thu May 20 21:04:49 2021 +0200
+++ b/LazyBear/Views/Global Helpers/StockItem.swift	Fri May 21 23:39:40 2021 +0200
@@ -21,9 +21,20 @@
     
     var body: some View {
         if orientation == .vertical {
-            return AnyView(VerticalStockRow(symbol: symbol, company: company, intradayPrices: intradayPrices))
+            let verticalRow: AnyView = AnyView(
+                NavigationLink(destination: CompanyView(symbol: symbol)) {
+                    VerticalStockRow(symbol: symbol, company: company, intradayPrices: intradayPrices)
+                }
+                .buttonStyle(PlainButtonStyle())
+            )
+            return verticalRow
         } else {
-            return AnyView(HorizontalStockRow(symbol: symbol, company: company, intradayPrices: intradayPrices, hidePriceView: hidePriceView ?? false))
+            let horizontalRow: AnyView = AnyView(
+                NavigationLink(destination: CompanyView(symbol: symbol)) {
+                    HorizontalStockRow(symbol: symbol, company: company, intradayPrices: intradayPrices, hidePriceView: hidePriceView ?? false)
+                }
+            )
+            return horizontalRow
         }
     }
 }