Xcode allows you to simulate your device or simulator’s location in order to test your app’s behavior in different locations. It comes with a list of major city centers out-of-the-box, but it’s not obvious how to add another location to that list.

Creating a GPX file

Locations in Xcode are defined by GPX files – a simple JSON structure that describes a location. In order to add a new location, we simply create our own and add it to the Workspace.

<gpx>
    <wpt lat="41.9028" lon="12.4964"></wpt>
</gpx>

Adding the GPX file to the Workspace

You can add the GPX file to the Workspace by selecting “Add GPX File to Workspace” from the drop-down selection of places in the location menu.

Easy!