Depends … on how you do things!
For my part, I’ve reduce bug crashing App when using: String ()
- String? make’s it wait for a value from the user (problematic).
- String () set’s a nil value.
- If using String? and the user skip some steps, tap or click on a place before entering a value that is needed the App will crash.
- String () already put the nil value to the App that needs to run. The value null will appear in a text field.
- You can use the same thing with: String (), Float (), Double (), etc.
How to code
- var stringName = String ()
- var stringName : String?
Alternative to code (it’s an other way that I found recently)
- var valueString: String! = “”
The equal (=) sign and the column (:) sign is different before using it.