Mercurial > public > lazybear
comparison 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 |
comparison
equal
deleted
inserted
replaced
424:6dd97877f575 | 425:4effac4733b0 |
---|---|
6 // | 6 // |
7 | 7 |
8 import SwiftUI | 8 import SwiftUI |
9 | 9 |
10 struct CurrencyRow: View { | 10 struct CurrencyRow: View { |
11 var latestCurrencies: [String: CurrencyModel] | 11 var latestCurrencies: [CurrencyModel] |
12 | 12 |
13 @State private var showExtensiveList = false | 13 @State private var showExtensiveList = false |
14 | 14 |
15 var body: some View { | 15 var body: some View { |
16 VStack(alignment: .leading) { | 16 VStack(alignment: .leading) { |
33 .padding(.horizontal) | 33 .padding(.horizontal) |
34 } | 34 } |
35 | 35 |
36 ScrollView(.horizontal, showsIndicators: false) { | 36 ScrollView(.horizontal, showsIndicators: false) { |
37 HStack(spacing: 20) { | 37 HStack(spacing: 20) { |
38 ForEach(Array(latestCurrencies.keys), id: \.self) { currencySymbol in | 38 ForEach(latestCurrencies, id: \.self) { currency in |
39 CurrencyItem(currencySymbol: currencySymbol, currency: latestCurrencies[currencySymbol]!) | 39 CurrencyItem(currency: currency) |
40 } | 40 } |
41 } | 41 } |
42 .padding() | 42 .padding() |
43 } | 43 } |
44 } | 44 } |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 struct CurrencyRow_Previews: PreviewProvider { | 51 struct CurrencyRow_Previews: PreviewProvider { |
52 static var previews: some View { | 52 static var previews: some View { |
53 CurrencyRow(latestCurrencies: ["AUD": CurrencyModel(flag: "🇺🇸", name: "Australian dollar", rate: 1.3116)]) | 53 CurrencyRow(latestCurrencies: [CurrencyModel(symbol: "AUD", name: "Australian dollar", flag: "🇺🇸", rate: 1.3116)]) |
54 } | 54 } |
55 } | 55 } |