I am trying to cast a wrapped value from a String to a float and I can't manage to do it. I think I'm missing a little knowledge about the whole wrapped/unwrapped (?/!) thing in swift.
I'm trying to get the text from a label.
Here's my label:
@IBOutlet weak var maxDistance: UILabel!
Here's what I tried:
var max = Float(maxDistance.text)!
--> Could not find an overload for 'init' that accepts the supplied arguments
var max = Float(maxDistance.text!)
--> Cannot invoke 'init' with an argument of type '@lvalue String'
var max = Float(maxDistance!.text)
--> Cannot invoke 'init' with an argument of type '@lvalue String?'
var max = Float(maxDistance?.text)
--> Cannot invoke 'init' with an argument of type '$T4??'