comparison LazyBear/Views/Home/Helpers/CurrencyListItem.swift @ 349:5ccceb527178

Implementing new internal API
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Wed, 14 Apr 2021 23:08:26 +0200
parents
children eb97439e46cd
comparison
equal deleted inserted replaced
348:0abb8d5c12ec 349:5ccceb527178
1 //
2 // CurrencyListItem.swift
3 // LazyBear
4 //
5 // Created by Dennis Concepción Martín on 14/4/21.
6 //
7
8 import SwiftUI
9
10 struct CurrencyListItem: View {
11 var currencySymbol: String
12 var currency: CurrencyModel
13
14 var body: some View {
15 HStack {
16 Text(currency.flag)
17 .padding(.trailing)
18
19 VStack(alignment: .leading) {
20 Text(currencySymbol)
21 .font(.headline)
22
23 Text(currency.name)
24 .font(.callout)
25 }
26
27 Spacer()
28 Text("$ \(currency.rate, specifier: "%.2f")")
29 .padding(.horizontal)
30 }
31 }
32 }
33
34 struct CurrencyRowItem_Previews: PreviewProvider {
35 static var previews: some View {
36 CurrencyListItem(currencySymbol: "AUD", currency: CurrencyModel(flag: "🇺🇸", name: "Australian dollar", rate: 1.3116))
37 }
38 }