changeset 34:a8d76aa51da2

Fixes crash textfield
author Dennis Concepción Martín <dennisconcepcionmartin@gmail.com>
date Fri, 23 Jul 2021 13:57:30 +0100
parents 462c1e823c8f
children 41a905e591e4
files Simoleon.xcodeproj/project.pbxproj Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate Simoleon/Helpers/ConversionBox.swift
diffstat 3 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Simoleon.xcodeproj/project.pbxproj	Fri Jul 23 13:39:04 2021 +0100
+++ b/Simoleon.xcodeproj/project.pbxproj	Fri Jul 23 13:57:30 2021 +0100
@@ -713,7 +713,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = Simoleon/Simoleon.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 7;
+				CURRENT_PROJECT_VERSION = 8;
 				DEVELOPMENT_ASSET_PATHS = "\"Simoleon/Preview Content\"";
 				DEVELOPMENT_TEAM = MTX83R5H8X;
 				ENABLE_PREVIEWS = YES;
@@ -738,7 +738,7 @@
 				ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
 				CODE_SIGN_ENTITLEMENTS = Simoleon/Simoleon.entitlements;
 				CODE_SIGN_STYLE = Automatic;
-				CURRENT_PROJECT_VERSION = 7;
+				CURRENT_PROJECT_VERSION = 8;
 				DEVELOPMENT_ASSET_PATHS = "\"Simoleon/Preview Content\"";
 				DEVELOPMENT_TEAM = MTX83R5H8X;
 				ENABLE_PREVIEWS = YES;
Binary file Simoleon.xcodeproj/project.xcworkspace/xcuserdata/dennis.xcuserdatad/UserInterfaceState.xcuserstate has changed
--- a/Simoleon/Helpers/ConversionBox.swift	Fri Jul 23 13:39:04 2021 +0100
+++ b/Simoleon/Helpers/ConversionBox.swift	Fri Jul 23 13:57:30 2021 +0100
@@ -9,7 +9,7 @@
 
 struct ConversionBox: View {
     @Binding var currencyPair: String
-    @Binding var amountToConvert: String
+    @Binding var amountToConvert: String { willSet { print(newValue) }}
     @Binding var price: Double
     @Binding var showingConversion: Bool
     @Binding var showingCurrencySelector: Bool
@@ -68,7 +68,7 @@
         if amountToConvert.isEmpty {  /// Avoid nil error when string is empty
             return 0
         } else {
-            let conversion = Double(amountToConvert)!  * price
+            let conversion = Double(amountToConvert) ?? 0  * price
 
             return conversion
         }