Getting Started - Navigine/Indoor-Navigation-iOS-Mobile-SDK-2.0 GitHub Wiki

To start using Navigation library in your project you should do the following steps.

Step 1

Register on https://locations.navigine.com, create a location and get your personal security key in the profile (it has the form 16 hexadecimal digits: XXXX-XXXX-XXXX-XXXX).

Step 2

Download framework , unzip it and add it to the your project.

Step 3

Set your user hash and server and get instance of Navigine SDK:

// Set user hash and server before getting the instance of [NavigineSdk](/Navigine/Indoor-Navigation-iOS-Mobile-SDK-2.0/wiki/class-NavigineSdk)

var mNavigineSdk: NCNavigineSdk?

mNavigineSdk = NCNavigineSdk.getInstance()
mNavigineSdk?.setServer(serverUrl) // your user hash from the server
mNavigineSdk?.setUserHash(userHash) // your server url (by default `https://ips.navigine.com`)
Step 4

Get instance of NCLocationManager, set NCLocationListenerand download a location archive from the server using the following (or similar) code:

var mLocationManager = mNavigineSdk?.getLocationManager()
mLocationManager.add(self)
mLocationManager.setLocation(/* your location id */)

...

extension YourControllerClass: NCLocationListener {
    func onLocationLoaded(_ location: NCLocation?) {
        // do smth with location
    }
    
    func onLocationUploaded(_ locationId: Int32) { 
        // do smth when location changes uploaded
    }
    
    func onLocationFailed(_ error: Error?) {
        // do smth with error
    }
}

Step 5

If location archive was successfully loaded you can start navigation (see NCNavigationManager for details). You can set the NCLocationView and it will display your position, or you can use NCNavigationManager and get updates about your position through NCPositionListener.

var mNavigationManager = mNavigineSdk?.getNavigationManager()
mNavigationManager.add(self)

...

extension YourControllerClass: NCPositionListener {
    func onPositionUpdated(_ position: NCPosition) {
        // do smth with position
    }

    func onPositionError(_ error: Error?) {
        // do smth with error
    }
}