Mercurial > public > simoleon
view Simoleon/UI/CurrencyButton.swift @ 167:1940db1ef321
Minor changes
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sat, 11 Sep 2021 16:30:40 +0200 |
parents | 0c589138a6f3 |
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") } }