comparison Simoleon/UI/ConversionBox.swift @ 156:84137052813d

Refactor code
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Sat, 28 Aug 2021 11:15:25 +0100
parents
children 0c589138a6f3
comparison
equal deleted inserted replaced
155:681f2cbe8c7f 156:84137052813d
1 ////
2 //// ConversionBox.swift
3 //// Simoleon
4 ////
5 //// Created by Dennis Concepción Martín on 18/07/2021.
6 ////
7 //
8 //import SwiftUI
9 //
10 //struct ConversionBox: View {
11 // var currencyDetails: CurrencyDetailsModel
12 // @State var currencyPair: CurrencyPairModel
13 //
14 // var body: some View {
15 // VStack(alignment: .leading) {
16 // Text("\(baseName) (\(currencyPair.baseSymbol))")
17 // .font(.callout)
18 // .fontWeight(.semibold)
19 // .padding(.top, 40)
20 //
21 // ZStack(alignment: .trailing) {
22 // TextField("Enter amount", text: $amount) { startedEditing in
23 // if startedEditing {
24 // withAnimation {
25 // amountIsEditing = true
26 // }
27 // }
28 // }
29 // onCommit: {
30 // withAnimation {
31 // amountIsEditing = false
32 // }
33 // }
34 // .keyboardType(.decimalPad)
35 // .font(Font.title.weight(.semibold))
36 // .lineLimit(1)
37 // .accessibilityIdentifier("ConversionTextField")
38 // }
39 //
40 // Divider()
41 //
42 // let quoteName = currencyDetails[currencyPair.quoteSymbol]!.name
43 // Text("\(quoteName) (\(currencyPair.quoteSymbol))")
44 // .font(.callout)
45 // .fontWeight(.semibold)
46 // .padding(.top, 10)
47 //
48 // if showingConversion {
49 // Text("\(makeConversion(), specifier: "%.2f")")
50 // .font(Font.title.weight(.semibold))
51 // .lineLimit(1)
52 // .padding(.top, 5)
53 // } else {
54 // ProgressView()
55 // .padding(.top, 5)
56 // }
57 // }
58 // .onAppear(perform: request)
59 // }
60 //
61 // /*
62 // if the amount can be converted to Double:
63 // * Return amount
64 // else:
65 // * Return zero
66 // */
67 // func makeConversion() -> Double {
68 // if let amountToConvert = Double(amount) {
69 // return amountToConvert * price // Conversion
70 // } else {
71 // return 0
72 // }
73 // }
74 //}
75 //
76 //
77 //struct ConversionBox_Previews: PreviewProvider {
78 // static var previews: some View {
79 // let fileController = File()
80 // let currencyDetails: [String: CurrencyDetailsModel] = try! fileController.read(json: "CurrencyDetails.json")
81 // ConversionBox(currencyPair: CurrencyPair(), currencyDetails: currencyDetails)
82 // }
83 //}