How can I set region format in XCTest?

ios, localization, objective-c, xctest

Solution

You can use a specific scheme for your different tests. For each scheme, add an "Argument Passed on Launch" like `-AppleLocale en_US`.

Problem

I want to test my code by changing region formats in (Settings > General > Language & Region) to different regions like UK, Japan etc. How can I do so programmatically?

Original source