String to Double?

let testField: String = “2.25”

    if let cost = Double(textField.text!) {
        
        print("The user entered a value price of \(cost)")
        
    } else {
        print("Not a valid number: \(textField.text!)")
    }

What am I doing wrong?? for I am getting this Error.
I am not understanding the Error.
Use of unresolved identifier ‘textField’

You got an typing error, you properties name is “testField”, you try to convert “textField”
If you correct your input, you get nevertheless an error, because the value of type String has no member “text”, try first convert the testField String to Double

let testField: String = “2.25”
let testFieldToDouble = (testField as NSString).doubleValue

Thank you, that is why you do not code very late at night. THANK YOU.

With pleasure, has also my headaches :slight_smile: