Keypad with metric dot separator instead of comma

We just launched an app with an internal setting for either metric or imperial. The app calculates various photographic formulas, and was build with numerical keypads which use a dot as a decimal point for metric (and not a comma decimal point).


We discovered after launch that the user's device Region setting changes our app's numerical keypad from a dot decimal input to a comma input. This was not what we were expecting, and it has crippled our app for users in Europe and elsewhere.


Is there a way to override the Regional numerical keypad, and have it always present the US numerical keypad with only a decimal dot?


This is a crisis for us, and we appreciate any help. Thank you.

Answered by highway61 in 345044022

Added the following in needed areas of code, and it fixed the issue. Thank you for your guidance.


numberFormatter.locale = Locale(identifier: "en_US")

numberFormatter.decimalSeparator = "."

numberFormatter.groupingSeparator = ","

You should not try and force user region setting (in fact, it is probably not allowed).


You have at least 2 options:

- design your specific keyboard

or simpler

- when you get input, replace any possible "," by '.".


The second is very simple solution to be implemented in the action for editing Did End and/or Did End On Exit of the textField.

Accepted Answer

Added the following in needed areas of code, and it fixed the issue. Thank you for your guidance.


numberFormatter.locale = Locale(identifier: "en_US")

numberFormatter.decimalSeparator = "."

numberFormatter.groupingSeparator = ","

Keypad with metric dot separator instead of comma
 
 
Q