This is a sample iOS app written in Swift that displays maps using Tangram ES.
-
Install Cocoapods
If you don't already have the CocoaPods tool installed, follow the installation instructions here: https://guides.cocoapods.org/using/getting-started.html#getting-started
-
Run
pod installTo download the dependencies described in our Podfile, run
pod installfrom the repository root. You only need to do this once, or again if you change the dependencies in the Podfile. -
Configure an app ID
Open
TangramSwiftSample.xcworkspaceand navigate to the configuration window for theTangramSwiftSampletarget. In theGeneralpane, find theBundle Identifierfield. Set a unique App ID in this field (usually these follow the formcom.my.namespace.TangramSwiftSample). -
Configure code signing
In the same configuration window as the last step, navigate to the
Signing & Capabilitiespane. Make sureAutomatically manage signingis enabled and select your iOS development team from theTeamfield below it. -
Configure an API key for map tiles
To display maps in the app, we need to access the Nextzen map tile server. If you don't already have one, sign up for a free API key here: https://developers.nextzen.org/
In the
TangramSwiftSampleworkspace, navigate toTangramSwiftSample/Info.plist. In the Value field next to theNextzenApiKeykey, enter your API key. -
Build and run from the Xcode Workspace
In the
TangramSwiftSampleworkspace, select your deployment target in the top-left corner and press the Play button to build and run the app. -
(Optional) Move your local app configuration to
Local.xcconfigIf you plan to work on this repository using git, you probably don't want to commit information like your code signing identity or an API key. Instead of keeping these in the tracked project files, you can put them in a xcconfig file. This file will be kept un-tracked by our
.gitignoreand our Xcode project is configured to check this file for settings.Create a text file in the repository root named
Local.xcconfigand add the following lines:DEVELOPMENT_TEAM = PRODUCT_BUNDLE_IDENTIFIER = NEXTZEN_API_KEY =After completing the configuration steps above, run
git diffon the repository to see the changes in the project files. The diff will show added values in the Xcode project files that correspond to the fields in our new xcconfig file. Copy the values into the xcconfig file.With the xcconfig file completed and saved, you can remove your local app configuration from the tracked project files by running
git checkouton any changed files.