Mercurial > public > simoleon
view Simoleon/UI/CurrencyButton.swift @ 156:84137052813d
Refactor code
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Sat, 28 Aug 2021 11:15:25 +0100 |
parents | |
children | 0c589138a6f3 |
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! read(json: "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") } }