Mercurial > public > simoleon
comparison Simoleon/UI/FavoritePairRow.swift @ 166:e4cbb1eea394
Implement FavoritesView
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sat, 11 Sep 2021 16:30:32 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
165:6f024e6a3b19 | 166:e4cbb1eea394 |
---|---|
1 // | |
2 // FavoritePairRow.swift | |
3 // Simoleon | |
4 // | |
5 // Created by Dennis Concepción Martín on 5/9/21. | |
6 // | |
7 | |
8 import SwiftUI | |
9 | |
10 struct FavoritePairRow: View { | |
11 var favoritePair: FavoritePair | |
12 let currencyDetails: [String: CurrencyModel] = try! readJson(from: "Currencies.json") | |
13 | |
14 var body: some View { | |
15 HStack { | |
16 let baseCurrencyDetails = currencyDetails[favoritePair.baseSymbol] | |
17 let quoteCurrencyDetails = currencyDetails[favoritePair.quoteSymbol] | |
18 | |
19 Flag(flag: baseCurrencyDetails!.flag) | |
20 Flag(flag: quoteCurrencyDetails!.flag) | |
21 .offset(x: -25) | |
22 .padding(.trailing, -25) | |
23 | |
24 Group { | |
25 Text("From \(baseCurrencyDetails!.symbol)") | |
26 Text("to \(quoteCurrencyDetails!.symbol)") | |
27 } | |
28 .font(.headline) | |
29 } | |
30 } | |
31 } | |
32 | |
33 struct FavoritePairRow_Previews: PreviewProvider { | |
34 static var previews: some View { | |
35 FavoritePairRow(favoritePair: FavoritePair()) | |
36 } | |
37 } |