diff LazyBear/Views/Home/Helpers/CurrencyRow.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 37c13ebda381
line wrap: on
line diff
--- a/LazyBear/Views/Home/Helpers/CurrencyRow.swift	Sun Jun 13 19:40:42 2021 +0200
+++ b/LazyBear/Views/Home/Helpers/CurrencyRow.swift	Wed Jun 16 13:46:01 2021 +0200
@@ -8,7 +8,7 @@
 import SwiftUI
 
 struct CurrencyRow: View {
-    var latestCurrencies: [String: CurrencyModel]
+    var latestCurrencies: [CurrencyModel]
 
     @State private var showExtensiveList = false
     
@@ -35,8 +35,8 @@
             
             ScrollView(.horizontal, showsIndicators: false) {
                 HStack(spacing: 20) {
-                    ForEach(Array(latestCurrencies.keys), id: \.self) { currencySymbol in
-                        CurrencyItem(currencySymbol: currencySymbol, currency: latestCurrencies[currencySymbol]!)
+                    ForEach(latestCurrencies, id: \.self) { currency in
+                        CurrencyItem(currency: currency)
                     }
                 }
                 .padding()
@@ -50,6 +50,6 @@
 
 struct CurrencyRow_Previews: PreviewProvider {
     static var previews: some View {
-        CurrencyRow(latestCurrencies: ["AUD": CurrencyModel(flag: "🇺🇸", name: "Australian dollar", rate: 1.3116)])
+        CurrencyRow(latestCurrencies: [CurrencyModel(symbol: "AUD", name: "Australian dollar", flag: "🇺🇸", rate: 1.3116)])
     }
 }