diff 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
line wrap: on
line diff
--- a/LazyBear/Views/Home/HomeView.swift	Sat Jun 12 15:20:04 2021 +0200
+++ b/LazyBear/Views/Home/HomeView.swift	Sat Jun 12 18:54:47 2021 +0200
@@ -34,7 +34,7 @@
                         let mirror = Mirror(reflecting: lists)
                         ForEach(Array(mirror.children), id: \.label) { child in
                             if let list = child.value as? [String : QuoteModel] {
-                                StockRow(listName: "\(child.label!)", list: list, intradayPrices: home.data.intradayPrices, addOnDelete: false)
+                                StockRow(listName: "\(adaptListTitle(child.label!))", list: list, intradayPrices: home.data.intradayPrices, addOnDelete: false)
                                     .listRowInsets(EdgeInsets())
                             }
                         }
@@ -71,6 +71,17 @@
 
         }
     }
+    
+    /*
+     Get list keys (mostactive, losers, active) and adapt them to diplay
+     */
+    private func adaptListTitle(_ title: String) -> String {
+        if title == "mostactive" {
+            return "Most active"
+        } else {
+            return title.capitalized
+        }
+    }
 }
 
 struct HomeView_Previews: PreviewProvider {