Re: NSMeasurementFormatter reversed


James Walker
 

On Sep 25, 2018, at 7:05 PM, Gerriet M. Denkmann <g@mdenkmann.de> wrote:

NSMeasurementFormatter is a magical tool which converts all stuff just into the right form the user wants to see.

But what about the other way round?

I have a TextField labeled “Desired Temperature” the user enters “83.4” - what does the user want?
Boiling hot (using Celsius) or comfortably warm (Fahrenheit)?
Typing

defaults find Temperature

at the command line produces

Found 1 keys in domain 'Apple Global Domain': {
AppleTemperatureUnit = Fahrenheit;
}

I’m not sure if you can get that with NSUserDefaults, maybe you have to use CFPreferences.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.