Mercurial > public > simoleon
view Simoleon/UI/CurrencyButton.swift @ 160:0c589138a6f3
Implement Conversion Box
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sun, 29 Aug 2021 19:04:34 +0100 |
parents | 84137052813d |
children |
line wrap: on
line source
// // CurrencyButton.swift // Simoleon // // Created by Dennis Concepción Martín on 24/8/21. // import SwiftUI struct CurrencyButton: View { var selectedCurrency: String let currencyDetails: [String: CurrencyModel] = try! readJson(from: "Currencies.json") var body: some View { let currency = currencyDetails[selectedCurrency]! RoundedRectangle(cornerRadius: 15) .foregroundColor(Color(.secondarySystemBackground)) .frame(height: 60) .overlay( HStack { Flag(flag: currency.flag) Text(currency.symbol) .foregroundColor(.primary) .font(.headline) } ) } } struct CurrencyButton_Previews: PreviewProvider { static var previews: some View { CurrencyButton(selectedCurrency: "USD") } }