comparison 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
comparison
equal deleted inserted replaced
325:cc3ba74d543e 326:2fabdc393675
6 // 6 //
7 7
8 import SwiftUI 8 import SwiftUI
9 9
10 struct SectorRow: View { 10 struct SectorRow: View {
11 var sectorPerformance: [SectorPerformanceModel]
11 12
12 var body: some View { 13 var body: some View {
13 VStack(alignment: .leading) { 14 VStack(alignment: .leading) {
14 Text("Performance by sector") 15 Text("Performance by sector")
15 .font(.title3) 16 .font(.title3)
16 .fontWeight(.semibold) 17 .fontWeight(.semibold)
17 .padding([.top, .horizontal]) 18 .padding([.top, .horizontal])
18 19
19 ScrollView(.horizontal, showsIndicators: false) { 20 ScrollView(.horizontal, showsIndicators: false) {
20 HStack(spacing: 20) { 21 HStack(spacing: 20) {
21 ForEach((1..<10)) { _ in 22 ForEach(sectorPerformance, id: \.self) { sector in
22 SectorItem() 23 SectorItem(sector: sector)
23 } 24 }
24 } 25 }
25 .padding() 26 .padding()
26 } 27 }
27 .frame(height: 170) 28 .frame(height: 170)
30 } 31 }
31 } 32 }
32 33
33 struct SectorRow_Previews: PreviewProvider { 34 struct SectorRow_Previews: PreviewProvider {
34 static var previews: some View { 35 static var previews: some View {
35 SectorRow() 36 SectorRow(sectorPerformance: [SectorPerformanceModel(name: "Technology", performance: 0.04, lastUpdated: 1617137138)])
36 } 37 }
37 } 38 }