I am using swift String(format:...) and need to compute values in the format string itself using ternary operator, something like this but it doesn't compiles.
String(format: "Audio: \(numChannels>1?"Stereo": "Mono")")
In Objective-C, I could do like this:
[NSString stringWithFormat:@"Audio: %@", numChannels > 1 ? @"Stereo" : @"Mono"];
How do I achieve the same elegance in Swift without having an intermediate variable?
let s = "Audio: \(numChannels > 1 ? "Stereo" : "Mono")"?and:String(formatand without String Interpolation:"Audio :" + (numChannels > 1 ? "Stereo" : "Mono")