diff Simoleon/Helpers/CurrencyList.swift @ 185:2fc95efcb1ee

connect backend
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Wed, 22 Dec 2021 16:12:23 +0100
parents d2398f02e1ce
children 1ebd1c5dd302
line wrap: on
line diff
--- a/Simoleon/Helpers/CurrencyList.swift	Mon Dec 20 12:28:22 2021 +0100
+++ b/Simoleon/Helpers/CurrencyList.swift	Wed Dec 22 16:12:23 2021 +0100
@@ -12,20 +12,28 @@
     @Binding var baseCurrency: SupportedCurrencyResult
     @Binding var quoteCurrency: SupportedCurrencyResult
     var selecting: Selection
+    @Environment(\.dismiss) var dismiss
     
     var body: some View {
         NavigationView {
             List {
                 let currencies = getCurrencies()
                 ForEach(currencies, id: \.self) { currency in
-                    Text(currency.code)
+                    CurrencyRow(currency: currency)
                 }
             }
             .navigationTitle("Currencies")
+            .toolbar {
+                ToolbarItem(placement: .destructiveAction) {
+                    Button(action: { dismiss() }) {
+                        Image(systemName: "multiply.circle.fill")
+                    }
+                }
+            }
         }
     }
     
-    // MARK: - Get compatible currencies given currency code
+    // Get compatible currencies given currency code
     func getCurrencies() -> [SupportedCurrencyResult] {
         let pairs: SupportedPairResponse = readJson(from: "SupportedCurrencies.json")
         let currencies: SupportedCurrencyResponse = readJson(from: "SupportedCurrencies.json")