diff LazyBear/Views/Home/HomeView.swift @ 425:4effac4733b0

Changing keys from API responses
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Wed, 16 Jun 2021 13:46:01 +0200
parents 6dd97877f575
children 5ca468751db2
line wrap: on
line diff
--- a/LazyBear/Views/Home/HomeView.swift	Sun Jun 13 19:40:42 2021 +0200
+++ b/LazyBear/Views/Home/HomeView.swift	Wed Jun 16 13:46:01 2021 +0200
@@ -31,14 +31,13 @@
                     }
                     
                     if let lists = home.data.lists {
-                        let mirror = Mirror(reflecting: lists)
-                        ForEach(Array(mirror.children), id: \.label) { child in
-                            if let list = child.value as? [String : QuoteModel] {
-                                StockRow(list: [child.label!: list], intradayPrices: home.data.intradayPrices)
-                                    .listRowInsets(EdgeInsets())
-                            }
+                        let listNames = Array(lists.keys.sorted())
+                        ForEach(listNames, id: \.self) { listName in
+                            StockRow(listName: listName, companies: lists[listName]!)
+                                .listRowInsets(EdgeInsets())
                         }
                     }
+                    
                     if let latestCurrencies = home.data.latestCurrencies {
                         CurrencyRow(latestCurrencies: latestCurrencies)
                             .listRowInsets(EdgeInsets())