Mercurial > public > simoleon
comparison Simoleon/Helpers/CurrencyRow.swift @ 15:a02f463aa906
Testing three column ipad navigation
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Thu, 15 Jul 2021 10:58:29 +0100 |
parents | 03ce7421c6f4 |
children | aec2e86e5dbd |
comparison
equal
deleted
inserted
replaced
14:03ce7421c6f4 | 15:a02f463aa906 |
---|---|
10 struct CurrencyRow: View { | 10 struct CurrencyRow: View { |
11 var currencyQuote: CurrencyQuoteModel | 11 var currencyQuote: CurrencyQuoteModel |
12 let currenciesMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") | 12 let currenciesMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") |
13 | 13 |
14 var body: some View { | 14 var body: some View { |
15 VStack(alignment: .leading) { | 15 RoundedRectangle(cornerRadius: 10) |
16 RoundedRectangle(cornerRadius: 10) | 16 .rectangleModifier(Color(.systemBackground), 80) |
17 .rectangleModifier(Color("Shadow"), 80) | 17 .overlay( |
18 | 18 HStack { |
19 RoundedRectangle(cornerRadius: 10) | 19 let symbols = currencyQuote.symbol!.split(separator: "/") |
20 .rectangleModifier(Color(.systemBackground), 80) | 20 let mainCurrencyFlag = currenciesMetadata[String(symbols[0])]!.flag |
21 .overlay( | 21 let secondaryCurrencyFlag = currenciesMetadata[String(symbols[1])]!.flag |
22 HStack { | 22 |
23 let symbols = currencyQuote.symbol!.split(separator: "/") | 23 FlagPair(mainCurrencyFlag: mainCurrencyFlag, secondaryCurrencyFlag: secondaryCurrencyFlag) |
24 let mainCurrencyFlag = currenciesMetadata[String(symbols[0])]!.flag | 24 |
25 let secondaryCurrencyFlag = currenciesMetadata[String(symbols[1])]!.flag | 25 VStack(alignment: .leading) { |
26 Text("\(String(symbols[0]))") | |
27 .fontWeight(.semibold) | |
26 | 28 |
27 FlagPair(mainCurrencyFlag: mainCurrencyFlag, secondaryCurrencyFlag: secondaryCurrencyFlag) | 29 Text("\(String(symbols[1]))") |
28 | 30 .fontWeight(.semibold) |
29 VStack(alignment: .leading) { | |
30 Text("\(String(symbols[0]))") | |
31 .fontWeight(.semibold) | |
32 | |
33 Text("\(String(symbols[1]))") | |
34 .fontWeight(.semibold) | |
35 } | |
36 .padding(.horizontal) | |
37 | |
38 VStack(alignment: .leading) { | |
39 Text("Bid") | |
40 let bid = currencyQuote.bid! | |
41 Text("\(bid, specifier: createSpecifier(bid))") | |
42 .fontWeight(.semibold) | |
43 .lineLimit(1) | |
44 | |
45 } | |
46 .padding(.trailing) | |
47 | |
48 VStack(alignment: .leading) { | |
49 Text("Ask") | |
50 let ask = currencyQuote.ask! | |
51 Text("\(ask, specifier: createSpecifier(ask))") | |
52 .fontWeight(.semibold) | |
53 .lineLimit(1) | |
54 | |
55 } | |
56 | |
57 Spacer() | |
58 | |
59 } | 31 } |
60 .padding(.horizontal) | 32 .padding(.horizontal) |
61 ) | 33 |
62 .offset(x: -6.0, y: -95.0) | 34 VStack(alignment: .leading) { |
63 .padding(.bottom, -95) | 35 Text("Bid") |
64 } | 36 let bid = currencyQuote.bid! |
65 .padding(.leading, 6) | 37 Text("\(bid, specifier: createSpecifier(bid))") |
66 .padding(.horizontal) | 38 .fontWeight(.semibold) |
39 .lineLimit(1) | |
40 | |
41 } | |
42 .padding(.trailing) | |
43 | |
44 VStack(alignment: .leading) { | |
45 Text("Ask") | |
46 let ask = currencyQuote.ask! | |
47 Text("\(ask, specifier: createSpecifier(ask))") | |
48 .fontWeight(.semibold) | |
49 .lineLimit(1) | |
50 | |
51 } | |
52 | |
53 Spacer() | |
54 | |
55 } | |
56 .padding(.horizontal) | |
57 ) | |
58 .padding(.horizontal) | |
67 } | 59 } |
68 | 60 |
69 /* | 61 /* |
70 Choose how many decimals depending on whether the price is hundreds, thousands, etc | 62 Choose how many decimals depending on whether the price is hundreds, thousands, etc |
71 */ | 63 */ |