diff LazyBear/Views/Home/Helpers/SectorRow.swift @ 326:2fabdc393675

Testing networking in HomeView
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Tue, 30 Mar 2021 23:13:14 +0200
parents 3e64824cca3e
children 80bfa88c6b0f
line wrap: on
line diff
--- a/LazyBear/Views/Home/Helpers/SectorRow.swift	Mon Mar 29 21:00:03 2021 +0200
+++ b/LazyBear/Views/Home/Helpers/SectorRow.swift	Tue Mar 30 23:13:14 2021 +0200
@@ -8,6 +8,7 @@
 import SwiftUI
 
 struct SectorRow: View {
+    var sectorPerformance: [SectorPerformanceModel]
     
     var body: some View {
         VStack(alignment: .leading) {
@@ -18,8 +19,8 @@
             
             ScrollView(.horizontal, showsIndicators: false) {
                 HStack(spacing: 20) {
-                    ForEach((1..<10)) { _ in
-                        SectorItem()
+                    ForEach(sectorPerformance, id: \.self) { sector in
+                        SectorItem(sector: sector)
                     }
                 }
                 .padding()
@@ -32,6 +33,6 @@
 
 struct SectorRow_Previews: PreviewProvider {
     static var previews: some View {
-        SectorRow()
+        SectorRow(sectorPerformance: [SectorPerformanceModel(name: "Technology", performance: 0.04, lastUpdated: 1617137138)])
     }
 }