comparison LazyBear/Views/Home/HomeView.swift @ 422:a38e8acccb85

Minor UI changes
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Sat, 12 Jun 2021 18:54:47 +0200
parents 5f21f7c23c5e
children 6dd97877f575
comparison
equal deleted inserted replaced
421:9b7af8e83d12 422:a38e8acccb85
32 32
33 if let lists = home.data.lists { 33 if let lists = home.data.lists {
34 let mirror = Mirror(reflecting: lists) 34 let mirror = Mirror(reflecting: lists)
35 ForEach(Array(mirror.children), id: \.label) { child in 35 ForEach(Array(mirror.children), id: \.label) { child in
36 if let list = child.value as? [String : QuoteModel] { 36 if let list = child.value as? [String : QuoteModel] {
37 StockRow(listName: "\(child.label!)", list: list, intradayPrices: home.data.intradayPrices, addOnDelete: false) 37 StockRow(listName: "\(adaptListTitle(child.label!))", list: list, intradayPrices: home.data.intradayPrices, addOnDelete: false)
38 .listRowInsets(EdgeInsets()) 38 .listRowInsets(EdgeInsets())
39 } 39 }
40 } 40 }
41 } 41 }
42 if let latestCurrencies = home.data.latestCurrencies { 42 if let latestCurrencies = home.data.latestCurrencies {
69 home.request("https://api.lazybear.app/home/type=init", .initial) 69 home.request("https://api.lazybear.app/home/type=init", .initial)
70 } 70 }
71 71
72 } 72 }
73 } 73 }
74
75 /*
76 Get list keys (mostactive, losers, active) and adapt them to diplay
77 */
78 private func adaptListTitle(_ title: String) -> String {
79 if title == "mostactive" {
80 return "Most active"
81 } else {
82 return title.capitalized
83 }
84 }
74 } 85 }
75 86
76 struct HomeView_Previews: PreviewProvider { 87 struct HomeView_Previews: PreviewProvider {
77 static var previews: some View { 88 static var previews: some View {
78 HomeView() 89 HomeView()