Onvert the text field’s string into a number in a locale- independent way

@IBAction func fahrenheitFieldEditingChanged(_ textField: UITextField) { //update the Fahrenheit value
if let text = textField.text, let number = numberFormatter.number(from: text) {
fahrenheitValue = Measurement(value: number.doubleValue, unit: .fahrenheit)
} else {
fahrenheitValue = nil
}
}
the compiler notes that numberFormatter use unresolved identifier !?!!

I have a similar issue where the compiler says "Generic parameter ‘UnitType’ could not be inferred. Then when I insert the suggested fix “Measuremenet” then I get an Expression type "Measuramenet is ambiguous without more context.

Can’t find the solution to this anywhere.

Here’s my code:

@IBAction func fahrenheitFieldEditingChanged(_ textField: UITextField) {

if let text = textField.text, let number = numberFormater.number(from: text) {
  fahrenheitValue = Measurement<Unit>(value: number.doubleValue, unit: .fahrenheit)
} else {
  fahrenheitValue = nil
}

}

I fixed the problem by just doing this:

fahrenheitValue = number.doubleValue

That’s it.