Search code examples
swiftswiftdate

iOS simulator keeps seeing old system calendar type (Gregorian/iso8601)


I changed calendar type from Gregorian to ISO8601 in my MacOS's system preferences but when I launch my app in simulator it always returns gregorian

Here's how I check the value:

print("Calendar.current.identifier = \(Calendar.current.identifier)")

Is there any other way to make simulator think my calendar is "ISO8601" apart from initializing calendar as "Calendar(identifier: .iso8601)" in my app?


Solution

  • The macOS system preferences don't affect the iOS simulator.

    You have to set the calendar in the virtual device of the simulator. However there is no ISO8601 calendar available – neither on a physical device – so you have to create it in code.