Mercurial > public > simoleon
diff Simoleon/ConversionView.swift @ 187:13d5a8deb6c2
add AboutView and FavoritesView
author | Dennis Concepcion Martin <dennisconcepcionmartin@gmail.com> |
---|---|
date | Thu, 23 Dec 2021 16:12:22 +0100 |
parents | 1ebd1c5dd302 |
children | e4f5dcf4d596 |
line wrap: on
line diff
--- a/Simoleon/ConversionView.swift Thu Dec 23 11:30:38 2021 +0100 +++ b/Simoleon/ConversionView.swift Thu Dec 23 16:12:22 2021 +0100 @@ -11,8 +11,8 @@ var showNavigationView: Bool? // CurrencySelector variables - @State private var baseCurrency = SupportedCurrencyResult(code: "EUR", name: "Euro", isCrypto: 0) - @State private var quoteCurrency = SupportedCurrencyResult(code: "CHF", name: "Swiss Franc", isCrypto: 0) + @State var baseCurrency: SupportedCurrencyResult + @State var quoteCurrency: SupportedCurrencyResult @State private var showingCurrencyList = false @State private var selecting: Selection = .baseCurrency @@ -40,7 +40,7 @@ } // MARK: - Favorite button - FavoriteButton() + FavoriteButton(baseCurrency: $baseCurrency, quoteCurrency: $quoteCurrency) } .padding(.bottom) @@ -63,7 +63,7 @@ amount: $amount ) } - .padding() + .padding(.horizontal) .sheet(isPresented: $showingCurrencyList) { CurrencyList(baseCurrency: $baseCurrency, quoteCurrency: $quoteCurrency, selecting: selecting) } @@ -96,7 +96,6 @@ let url = "https://api.simoleon.app/fx/latest?symbols=\(currencyPair)" httpRequest(url: url, model: CurrencyLatestRateResponse.self) { response in latestRate = response - print(latestRate.message.first!.timestamp) if latestRate.message.isEmpty { // Handle exception } else { @@ -112,6 +111,9 @@ struct ConversionView_Previews: PreviewProvider { static var previews: some View { - ConversionView(showNavigationView: true) + ConversionView( + baseCurrency: SupportedCurrencyResult(code: "EUR", name: "Euro", isCrypto: 0), + quoteCurrency: SupportedCurrencyResult(code: "USD", name: "U.S. Dollar", isCrypto: 0) + ) } }