I want to use an Optional variable with the ternary conditional operator but it is throwing error this error: optional cannot be used as boolean. What am I doing wrong?
In case the comparison is based on some condition
let sliderValue = Float(self.preferenceData.getLocationRadius().characters.count > 1 ?self.preferenceData.getLocationRadius():"0.1")
Here the function getLocationRadius() returns a String. One more thing if we don't put a space between 1 and ? it results in an syntax error