Swift 4: Printing out Bool optionals as either unwrapped true or false or as wrapped nil?
问题 Basically I want to print the below value as either "true", "false" or "nil". If I try just using the wrapped value I get the "nil" I want but gain the unwanted "Optional(true)" or "Optional(false). If I force unwrap the value and the value is nil I get a fatal error. I tried the below code as I've seen it work for Strings but because "nil" is not of type Bool it's not accepted. Any solutions to this? var isReal: Bool? String("Value is \(isReal ?? "nil")") I'm exporting to a csv file and it's