So far, we've taught you how to migrate your mapping application from Google Maps to HERE Maps with web maps, routing, predictive routing with traffic, and geocoding. Today, I'll walk you through how to easily transfer your iOS (Swift) application to HERE Maps.
In this guide, I'll provide some quick steps to swap out the Google Maps mobile SDK for the HERE Maps mobile SDK. The process is fairly straightforward and should only take about 10-15 minutes to get a basic map with a marker up and running on your iPhone.
If you'd like to explore the SDK before we get started, feel free to take a look at the official documentation.
You can follow along with an existing Xcode project, or you can start from scratch. Both work fine.
Developer Portal Authentication
First things first, we'll have to head over to the HERE Developer Portal and register our project in order to grab an app id and code. Create a new project, and be sure to click Generate App ID and App Code under the iOS SDK section. You'll also have to input your project's iOS bundle ID from Xcode. Keep this window open--we'll be using these codes in our project in just a few minutes.
In the project's Podfile, swap out pod 'GoogleMaps' for pod 'HEREMapsStarter'.
Go ahead and install those dependencies with pod install. Wasn't that quick? We've already installed the HERE Maps SDK. Just a few more steps until we have an interactive map up and running...
The HERE Maps SDK is configured very similarly to the Google Maps SDK in Xcode. Both SDK's authentication is taken care of in the AppDelegate.swift file. So let's open up that up and start making some changes.
We can go ahead and get rid of the import GoogleMaps statement and replace that with import NMAKit in the file's header.
Next, edit the didFinishLaunchingWithOptions method to add your authentication code.
Let's head over to ViewController.swift to initialize our map view.
Be sure to include import NMAKit in the file's header. With just a few lines of code, we're able to get an interactive map with a marker setup!
Happy coding! We'd love to see what you build with the HERE Developer APIs and SDKs--reach out to us @heredev to share any awesome projects.