Here is step by step guide to create perfect GPX file from one location to another location.
Now we get the direction between Atlanta, Georgia, USA to Sandy Springs, Georgia, USA. We can choose any route from multiple available routes like displayed in screenshot.
directiongooglemap-jnb3f0.png)

<gpx version="1.1" creator="GPS Visualizer http://www.gpsvisualizer.com/" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd">
Replace With
<gpx version="1.1" creator="Xcode">
Xcode only work with WPT tag. Now you will see that there are only 2 WPT tags in GPX file. So, if I keep it as it is then simulation won’t work perfectly. So, we need to replace all tags. click here to get sample perfect GPX file.
Using GPX File
Now we have perfect file of GPX. So we are going to use that file. Create the sample Xcode project and follow the below steps :- 1) Create Xcode project GPXUse. 2) After creating Xcode project we need to get location permission. Here is sample code of getting location permission and update current location of the device in AppDelegate :-func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { locationManager.delegate = self locationManager.desiredAccuracy = kCLLocationAccuracyBest if CLLocationManager.locationServicesEnabled() { switch(CLLocationManager.authorizationStatus()) { case .authorizedAlways, .authorizedWhenInUse: locationManager.startUpdatingLocation() break case .notDetermined: locationManager.requestWhenInUseAuthorization() break case .restricted: print("Restricted.") break case .denied: UIApplication.shared.open(URL(string:UIApplicationOpenSettingsURLString)!, options: [:], completionHandler: nil) } } return true }
func locationManager(_ manager: CLLocationManager, didChangeAuthorization status: CLAuthorizationStatus) { if status == .authorizedWhenInUse { locationManager.startUpdatingLocation() } }
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { print("User current location===>>",locations) }
Add Permission
After you add above code in AppDelegate file, you need to add permission key in info.plist file. Here are 2 lines which you need to add in info.plist file of your project :- key.Privacy – Location When In Use Usage Description Privacy – Location Always and When In Use Usage Descriptionaddgpxfile-kzxuza.png)
startsimulation-op4sbr.png)

