Cannot infer contextual base in reference to member 'fractionLength'

I am trying to format a measurement in my application as described in this documentation.

Notice the example code:

let temp = Measurement<UnitTemperature>(value: 38, unit: .celsius)
let formattedTemp = temp.formatted(.measurement(width: .wide, usage: .weather, numberFormat: .numeric(precision: .fractionLength(1))))
// For locale: en_US: 100.4 degrees Fahrenheit

When I try to do the same, I receive the following errors:

Cannot infer contextual base in reference to member 'fractionLength'
Cannot infer contextual base in reference to member 'numeric'
Extra argument 'numberFormat' in call

My code is as follows:

Text("\(current.temperature.formatted(.measurement(width: .wide, usage: .weather, numberFormat: .numeric(precision: .fractionLength(1)))))")

Where current is a CurrentWeather type provided by WeatherKit.

Why is my adherence to the documentation causing these errors?

Replies

First, try this:

Text("Measurement: \(current.temperature.formatted(.measurement(width: .wide, usage: .weather, numberFormatStyle: .number)))")