iOS Setup

Prerequisites

SDK Configuration

The AirMapSDK-Swift library reads a JSON configuration file during initialization. This airmap.config.json file can be downloaded from the AirMap Developer Portal and placed in the root of the project's app bundle.

Mapbox Api Key

AirMap provides AirMapMapView, which exposes methods that allow you to contextually configure the map. AirMapMapView is a subclass of MGLMapView, which is provided by the Mapbox SDK. Please sign up and request a Mapbox access token: https://www.mapbox.com/ios-sdk/#access_tokens

You can add this access token to your airmap.config.json.

Dependencies

The AirMapSDK-Swift library and its dependencies are available via CocoaPods or Carthage.

Always check the Github repo for the latest release versions: SDK Releases

CocoaPods

The CocoaPods version is broken down into various subspecs including AirMapSDK/Core, AirMapSDK/Traffic, AirMapSDK/Telemetry, and AirMap/UI. To install all components, use AirMapSDK.

pod 'AirMapSDK', :git => 'https://github.com/airmap/AirMapSDK-Swift', :tag => '2.0.0.rc.3'

As the SDK uses a Swift 3 library, you will need to add the following at the end of your Podfile

post_install do |installer|
    # List of Pods to use as Swift 3.2
    swift3targets = ['Lock'] 

    installer.pods_project.targets.each do |target|
        if swift3targets.include? target.name
            target.build_configurations.each do |config|
                config.build_settings['SWIFT_VERSION'] = '3.2'
            end
        end
    end
end

Carthage

To install the iOS SDK using Carthage dependency management add the following to your Cartfile:

github "airmap/AirMapSDK-Swift" "2.0.0.rc.3"

Importing Library

To use the AirMap SDK within your code, add the following import statement:

import AirMap

Example Application

An example iOS app is available in the AirMapSDK-Swift repository.

Example App Setup

Clone Repo

$ git clone https://github.com/AirMap/AirMapSDK-Swift.git
$ cd AirMapSDK-Swift

Install Dependencies

$ cd Example
$ pod install

Open the project

$ open AirMapSDK.xcworkspace

Configure AirMap

Download your application's airmap.config.json file from the AirMap Developer Portal and set the Mapbox access token.

Add the configuration file to the root of the project.

iOS Setup