diff Simoleon/UI/CurrencySelector.swift @ 159:35628bac01f5

Fix a bug that selected wrong symbol in pair
author Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com>
date Sat, 28 Aug 2021 19:18:50 +0100
parents 8c3bbd640103
children 0c589138a6f3
line wrap: on
line diff
--- a/Simoleon/UI/CurrencySelector.swift	Sat Aug 28 19:17:55 2021 +0100
+++ b/Simoleon/UI/CurrencySelector.swift	Sat Aug 28 19:18:50 2021 +0100
@@ -10,7 +10,7 @@
 struct CurrencySelector: View {
     @State var currencyPair: CurrencyPairModel
     @State private var showingList = false
-    @State private var modalSelection: ModalType? = nil
+    @State private var modalSelection: ModalType = .allCurrencies
     let currencyPairsSupported: [String] = try! read(json: "CurrencyPairsSupported.json")
     
     private enum ModalType {
@@ -20,15 +20,15 @@
     var body: some View {
         HStack {
             Button(action: {
+                modalSelection = .allCurrencies
                 showingList = true
-                modalSelection = .allCurrencies
             }) {
                 CurrencyButton(selectedCurrency: currencyPair.baseSymbol)
             }
             
             Button(action: {
+                modalSelection = .compatibleCurrencies
                 showingList = true
-                modalSelection = .compatibleCurrencies
             }) {
                 CurrencyButton(selectedCurrency: currencyPair.quoteSymbol)
             }