HERE iOS SDK Developer's Guide

Creating a Simple HERE SDK Application Using Swift

This tutorial provides instructions on how to create a simple application using the Swift programming language. It is equivalent to the Objective-C tutorial, which is located at Creating a Simple Application Using the HERE SDK.

Development tasks for this basic application include:
  • Create a new Xcode project
  • Add necessary resources and a map view to the project
  • Acquire credentials from HERE for accessing map services
  • Initialize the map view such that a map instance is created for rendering on the client device
The contents of this guide apply to Xcode 8 and the iOS 10 SDK.

Create a New Single View Application

  1. From XCode menu, select File > New > Project to open the New project dialog (or press Shift + Command + N).
  2. Select iOS > Application > Single View Application as the application type you want to create. Press Next.
  3. In the next dialog, enter your Product Name (such as HelloMap) and Organization Identifier (such as edu.self). Choose "Swift" under Language, then choose "iPhone" under Devices, then click Next.
  4. Navigate to the directory where you want your project to be stored and then select Create.
  5. The next step is to configure this project to use the HERE SDK.

Configure the Application

  1. Extract the HERE iOS SDK archive to somewhere in your local file system.
  2. Add the NMAKit framework and bundle to your Xcode project. To add the NMAKit framework to your Xcode project, open the add files dialog. Select File > Add Files To [Project Name], then select the "NMAKit.framework" folder. Ensure that the "Create folder references" option is selected, then select Add.
    Note: Dragging the NMAKit framework directory from the Finder into your project also has the same effect.
    Figure 1. Add File to Target
  3. Do the same for the NMABundle.bundle file. This file is found in the HelloMap/NMAKit.framework/Resource directory. However, do not select the "Copy items if needed" option.
  4. Next, add the NMAKit dependencies to your Xcode project. The NMAKit has a number of dependencies on other frameworks and libraries. Ensure that the items in the following list are present in the Targets > Build Phases > Link Binary With Libraries section. If they are not present, add them using the + sign button. You can find this section by clicking on your project, in the Project Navigator and then selecting the Build Phases tab in the Standard Editor.

    • libc++.dylib
    • GLKit.framework
    • SystemConfiguration.framework
  5. Navigate to the General tab and check Embedded Binaries to verify if NMAKit.framework is added. If it is not, click the "+" button to add it manually.
    Figure 2. Embedded Binaries
  6. Run the application. From the Xcode menu bar, select Product > Run. Ensure that the project runs in the iOS Simulator without errors.
  7. The HERE iOS SDK is now ready for use in your Xcode project. Now that you have your project configured to work with the HERE SDK, try extending the sample application to render a map.

Create the Map View

In this section, we utilize the NMAMapView and NMAGeoCoordinates classes to render a Map.

  1. Create a bridging header file for NMAKit.

    1. From the Xcode menu bar, select File > New > File...
    2. Select "Header File" and click Next.
    3. In the Save sheet, leave the file location as the HelloMap folder and set the file name, such as Header. Click "Create".
    4. Replace the entire contents of the header file with the following:
      #import <NMAKit/NMAKit.h>
    5. Next, left-click on the project name (HelloMap) in the Project Navigator. Click on "Build Settings".
    6. Under the "Swift Compiler - Code Generation" section, double-click on the entry for "Objective-C Bridging Header" and enter the following:
  2. Create an NMAMapView.

    1. Select Main.storyboard in the navigator, then open the Utilities view by pressing the key combination Command + Option + Control + 3. Drag and drop a View object from the Object Library onto the View Controller. If necessary, resize the View so it takes up the entire viewable area.
    2. In the Interface Builder, click on the created View and then open the Identity Inspector in the Utilities view by pressing the key combination Command + Option + 3. Change the class value from UIView to NMAMapView and press return. In the Document Outline, you should see that the name of the View has changed from to View to Map View.
    Figure 3. MapView
  3. Create an outlet to NMAMapView in ViewController.

    1. Select Main.storyboard in the navigator.
    2. Press Command + Option + Return to open the Assistant Editor. It should show ViewController.swift.
    3. Hold the Control key on the keyboard and click to drag from the Map View to the interface block in ViewController.swift. You should see a blue line and tooltip which says "Insert Outlet or Outlet Connection". Release the mouse button and a dialog appears, allowing you to create an outlet.
    4. Name the outlet mapView, keep the other default options and then select Connect.

    Figure 4. Create an Outlet
  4. Now an outlet to NMAMapView is set. The modified file should be as follows:

    import UIKit
    class ViewController: UIViewController {
      @IBOutlet weak var mapView: NMAMapView!
      override func viewDidLoad() {
        // Do any additional setup after loading the view, typically from a nib.
      override func didReceiveMemoryWarning() {
        // Dispose of any resources that can be recreated.
  5. Implement NMAMapView setup and lifecycle code by replacing the viewDidLoad() function with viewWillAppear(animated) and addMapCircle():
    override func viewWillAppear(animated: Bool) {
      mapView.useHighResolutionMap = true
      var coordinates: NMAGeoCoordinates
      coordinates = NMAGeoCoordinates(latitude: 49.258867, longitude: -123.008046)
      mapView.zoomLevel = 13.2
      mapView.setGeoCenter(coordinates, withAnimation: NMAMapAnimation.Linear)
      mapView.copyrightLogoPosition = NMALayoutPosition.BottomCenter
    func addMapCircle() {
      if mapCircle == nil {
        let coordinates: NMAGeoCoordinates =
          NMAGeoCoordinates(latitude: 49.258867, longitude: -123.008046)
        mapCircle = NMAMapCircle(geoCoordinates: coordinates, radius: 50)
  6. Add your HERE application credentials.
    1. Open the AppDelegate.swift file.
    2. Add the following in the application(_:didFinishLaunchingWithOptions) function, replacing YOUR_APP_ID and YOUR_APP_CODE with the credentials that you received from your
      NMAApplicationContext.setAppId("YOUR_APP_ID", appCode: "YOUR_APP_CODE")
  7. Build and run the application. If the build is successful, you now have an application that displays a map similar to the following screenshot and allows you to manipulate it using gestures.

    Figure 5. Running the App Running the App

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on