I have two different Apps that I run from XCode on the same device.
In AppDelegate application didFinishLaunchingWithOptions I print out the following debugging message:
print( Locale.current )
In one App it prints out sv_SE
(as I would expect), but on the other App it prints out en_SE
!!
As a result, dateFormatter.string
will produce english names instead of the Swedish names that I where expecting.
func dayOfWeek(date:Date) -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "EEEE"
dateFormatter.locale = Locale.current // locale is en_SE not sv_SE ???
let dayname = dateFormatter.string(from: date).capitalized
return dayname // returns SATURDAY not LÖRDAG
}
Question: Why do I get different locales in different Apps when ran on the same device?