The recommended way to use Tangram in an iOS project is to add it as a CocoaPods dependency. The library is hosted in CocoaPods under the pod name Tangram-es. To find the latest version, check CocoaPods: https://cocoapods.org/pods/Tangram-es. Then follow the instructions from CocoaPods on adding a pod to your Xcode project: https://guides.cocoapods.org/using/using-cocoapods.html.
That's it! If you want to build Tangram for iOS from source instead, continue reading.
This project uses CMake (minimum version 3.2), you can download it here or use your favorite installation package tool like homebrew.
brew install cmake
Make sure to update git submodules before you build:
git submodule update --init
You can optionally install xcpretty to produce much prettier and more legible output during the build process:
gem install xcpretty
You will need a Nextzen API key to use the vector-tile and terrain service that is being used from the stylesheet of the demo app. To get an API key visit: developers.nextzen.org.
Building the iOS demo application requires Xcode 9.0 or newer. From the root directory of the project, run:
make ios-xcode NEXTZEN_API_KEY=yourApiKeyHere
You can optionally append a BUILD_TYPE
variable to choose the build type, for example BUILD_TYPE=Debug
or BUILD_TYPE=Release
.
This will generate an Xcode project for the Tangram iOS framework and demo application and open the project in an Xcode workspace.
Note on Code Signing and Provisioning Profiles:
- For Simulator: Code signing is not required, so you can ignore any signing errors in target TangramDemo > General > Signing.
- For Device: You will have to modify the Bundle Identifier in target TangramDemo > General > Identity > Bundle Identifier to something other than
com.mapzen.ios.TangramDemo
, since App IDs are associated with a specific signing identity.
To build an iOS binary framework bundle compiled for iOS devices, run:
make ios-framework
The framework will be output in '/build/ios/CONFIG-iphoneos/', where CONFIG is 'Release' or 'Debug' according to the build type.
To build a universal binary framework compiled for both iOS devices and the iOS simulator, run:
make ios-framework-universal
The framework will be output in '/build/ios/CONFIG-universal/', where CONFIG is 'Release' or 'Debug' according to the build type.