Mercurial > public > simoleon
comparison Simoleon/Helpers/CurrencyRow.swift @ 75:b6f8661300f2
Added isLocked to CurrencyPairs
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Fri, 30 Jul 2021 15:52:27 +0100 |
parents | c7b6249ab745 |
children | 1069c33d3a42 |
comparison
equal
deleted
inserted
replaced
74:bfb959bee6d7 | 75:b6f8661300f2 |
---|---|
6 // | 6 // |
7 | 7 |
8 import SwiftUI | 8 import SwiftUI |
9 | 9 |
10 struct CurrencyRow: View { | 10 struct CurrencyRow: View { |
11 var currencyPair: String | 11 var currencyPairName: String |
12 | |
13 let currencyMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") | 12 let currencyMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") |
14 | 13 |
15 var body: some View { | 14 var body: some View { |
16 HStack { | 15 HStack { |
17 let currencies = currencyPair.split(separator: "/") | 16 let currencies = currencyPairName.split(separator: "/") |
18 Image(currencyMetadata[String(currencies[0])]!.flag) | 17 Image(currencyMetadata[String(currencies[0])]!.flag) |
19 .resizable() | 18 .resizable() |
20 .aspectRatio(contentMode: .fill) | 19 .aspectRatio(contentMode: .fill) |
21 .frame(width: 30, height: 30) | 20 .frame(width: 30, height: 30) |
22 .clipShape(Circle()) | 21 .clipShape(Circle()) |
41 } | 40 } |
42 } | 41 } |
43 | 42 |
44 struct CurrencyRow_Previews: PreviewProvider { | 43 struct CurrencyRow_Previews: PreviewProvider { |
45 static var previews: some View { | 44 static var previews: some View { |
46 CurrencyRow(currencyPair: "USD/GBP") | 45 CurrencyRow(currencyPairName: "USD/GBP") |
47 } | 46 } |
48 } | 47 } |