Separate thousands with commas. On the simulator, everything works perfectly, but on the device, for some reason, the same code, instead of a comma, puts a space.
You are wrong, the formatter works correctly both on the simulator and on the device - each just uses a different locale. If this is a number displayed to the user then it's completely correct that the number is formatted in the user's locale.
If you want to use a specific locale everywhere, you have to set it explicitly, e.g.:
formatter.locale = Locale(identifier: "en_US")