Mercurial > public > simoleon
diff Simoleon/Helpers/CurrencyRow.swift @ 21:c3dda63f50ed v1.1
Added Core Data and UI changes
- Implement Watchlist
- Change conversion design
- Improve UX
author | Dennis Concepción Martín <dennisconcepcionmartin@gmail.com> |
---|---|
date | Mon, 19 Jul 2021 19:27:12 +0100 |
parents | 94fd7ac93060 |
children | c52966834f83 |
line wrap: on
line diff
--- a/Simoleon/Helpers/CurrencyRow.swift Mon Jul 19 10:12:23 2021 +0100 +++ b/Simoleon/Helpers/CurrencyRow.swift Mon Jul 19 19:27:12 2021 +0100 @@ -8,37 +8,40 @@ import SwiftUI struct CurrencyRow: View { - var currency: String + var currencyPair: String let currencyMetadata: [String: CurrencyMetadataModel] = parseJson("CurrencyMetadata.json") var body: some View { HStack { - Image(currencyMetadata[currency]!.flag) + let currencies = currencyPair.split(separator: "/") + Image(currencyMetadata[String(currencies[0])]!.flag) .resizable() .aspectRatio(contentMode: .fill) .frame(width: 30, height: 30) .clipShape(Circle()) .overlay(Circle().stroke(Color(.systemGray), lineWidth: 1)) - VStack(alignment: .leading) { - Text("\(currency)") - .fontWeight(.semibold) - .foregroundColor(Color("PlainButton")) - - Text("\(currencyMetadata[currency]!.name)") - .font(.footnote) - .fontWeight(.semibold) - .foregroundColor(Color("PlainButton")) - .opacity(0.5) - .lineLimit(1) - } - .padding(.horizontal) + Image(currencyMetadata[String(currencies[1])]!.flag) + .resizable() + .aspectRatio(contentMode: .fill) + .frame(width: 30, height: 30) + .clipShape(Circle()) + .overlay(Circle().stroke(Color(.systemGray), lineWidth: 1)) + .offset(x: -20) + .padding(.trailing, -20) + + Text("From \(String(currencies[0])) to \(String(currencies[1]))") + .fontWeight(.semibold) + .foregroundColor(Color("PlainButton")) + .padding(.leading) + + Spacer() } } } struct CurrencyRow_Previews: PreviewProvider { static var previews: some View { - CurrencyRow(currency: "USD") + CurrencyRow(currencyPair: "USD/GBP") } }