comparison LazyBear/Views/Home/Helpers/CurrencyItem.swift @ 425:4effac4733b0

Changing keys from API responses
author Dennis Concepción Martín <66180929+denniscm190@users.noreply.github.com>
date Wed, 16 Jun 2021 13:46:01 +0200
parents 6dd97877f575
children 417148200aaf
comparison
equal deleted inserted replaced
424:6dd97877f575 425:4effac4733b0
6 // 6 //
7 7
8 import SwiftUI 8 import SwiftUI
9 9
10 struct CurrencyItem: View { 10 struct CurrencyItem: View {
11 var currencySymbol: String
12 var currency: CurrencyModel 11 var currency: CurrencyModel
13 var rectangleWidth: CGFloat?
14 12
15 var body: some View { 13 var body: some View {
16 RoundedRectangle(cornerRadius: 8) 14 RoundedRectangle(cornerRadius: 8)
17 .foregroundColor(Color(.secondarySystemBackground)) 15 .foregroundColor(Color(.secondarySystemBackground))
18 .frame(width: 330, height: 50) 16 .frame(width: 330, height: 50)
22 .frame(width: 40) 20 .frame(width: 40)
23 .overlay( 21 .overlay(
24 Text(currency.flag) 22 Text(currency.flag)
25 ) 23 )
26 VStack(alignment: .leading) { 24 VStack(alignment: .leading) {
27 Text("USD/\(currencySymbol)") 25 Text("USD/\(currency.symbol)")
28 .font(.headline) 26 .font(.headline)
29 27
30 Text(currency.name) 28 Text(currency.name)
31 .font(.callout) 29 .font(.callout)
32 } 30 }
40 } 38 }
41 } 39 }
42 40
43 struct CurrencyItem_Previews: PreviewProvider { 41 struct CurrencyItem_Previews: PreviewProvider {
44 static var previews: some View { 42 static var previews: some View {
45 CurrencyItem(currencySymbol: "AUD", currency: CurrencyModel(flag: "🇺🇸", name: "Australian dollar", rate: 1.3116)) 43 CurrencyItem(currency: CurrencyModel(symbol: "AUD", name: "Australian dollar", flag: "🇺🇸", rate: 1.3116))
46 } 44 }
47 } 45 }