Mercurial > public > lazybear
view LazyBear/Views/Home/Helpers/CurrencyListItem.swift @ 417:5f21f7c23c5e
Add comments and clean code
author | Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com> |
---|---|
date | Fri, 11 Jun 2021 11:37:42 +0200 |
parents | eb97439e46cd |
children |
line wrap: on
line source
// // CurrencyListItem.swift // LazyBear // // Created by Dennis Concepción Martín on 14/4/21. // import SwiftUI struct CurrencyListItem: View { var currencySymbol: String var currency: CurrencyModel var body: some View { HStack { Text(currency.flag) .padding(.trailing) VStack(alignment: .leading) { Text("USD/\(currencySymbol)") .font(.headline) Text(currency.name) .font(.callout) } Spacer() Text("\(currency.rate, specifier: "%.2f")") .padding(.horizontal) } } } struct CurrencyRowItem_Previews: PreviewProvider { static var previews: some View { CurrencyListItem(currencySymbol: "AUD", currency: CurrencyModel(flag: "🇺🇸", name: "Australian dollar", rate: 1.3116)) } }