I am trying to show the temperature from weatherkit in a text field. If I use 'temp.formatted(.measurement(width: .abbreviated, usage: .weather)' for -0.31C it shows a weird value of -33F. It works for positive celsius values, only the negative ones have this issue.
Is there anything obvious I am doing wrong in the code shown? I am just starting to do some learning project with swiftUI.
let temp = Measurement(value: -0.31, unit: UnitTemperature.celsius)
print(temp)
print("Current default locale: \(Locale.current)")
print("\(temp.formatted(.measurement(width: .abbreviated, usage: .weather)))")
print(MeasurementFormatter().string(from: temp)) //this works
Output:
-0.31 °C
Current default locale: en_US (current)
-33°F
31.442°F