My app reads lines such as TEMP:23 from a serial-to-Bluetooth module and converts the number with Int(parts[1])!. It ran for hours and then crashed with "Unexpectedly found nil while unwrapping an Optional value". The line that caused it looked normal in the log.
I understand that ! is the problem, but what should replace it? There seem to be many options: if let, guard let, ??, ?.. When is each the right tool?




