iOS18 beta API

When the usesGroupingSeparator is set to yes on iOS18, the groupingSize value becomes 3. groupingSize is different from 0 in earlier iOS18 versions. Is it a bug or will the subsequent official version also make relevant adjustments? We need to adapt the app in advance。 let formatter = NumberFormatter() let temp = NSNumber(floatLiteral: value) formatter.usesGroupingSeparator = true; print(formatter.string(from: temp) ?? "","--",formatter.groupingSize) Print results below: iOS18 2222222 -- 0 earlier iOS18 2,222,222 -- 3

Answered by DTS Engineer in 796114022

Oh, that’s weird. Arguably the new behaviour is better, but I can certainly see how a change of behaviour might cause problems. I recommend that you file a bug about this. Please post your bug number, just for the record.

Having said that, can you explain more about how you encountered this? In general, you shouldn’t use NumberFormatter without setting the numberStyle property. And, if you set that property to .decimal, you get grouping separators based on your locale.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Oh, that’s weird. Arguably the new behaviour is better, but I can certainly see how a change of behaviour might cause problems. I recommend that you file a bug about this. Please post your bug number, just for the record.

Having said that, can you explain more about how you encountered this? In general, you shouldn’t use NumberFormatter without setting the numberStyle property. And, if you set that property to .decimal, you get grouping separators based on your locale.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

iOS18 beta API
 
 
Q