Skip to content

tangrams/tangram-swift-sample

Repository files navigation

Tangram Swift Sample

This is a sample iOS app written in Swift that displays maps using Tangram ES.

Build and Run the Sample

  1. 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

  2. Run pod install

    To download the dependencies described in our Podfile, run pod install from the repository root. You only need to do this once, or again if you change the dependencies in the Podfile.

  3. Configure an app ID

    Open TangramSwiftSample.xcworkspace and navigate to the configuration window for the TangramSwiftSample target. In the General pane, find the Bundle Identifier field. Set a unique App ID in this field (usually these follow the form com.my.namespace.TangramSwiftSample).

  4. Configure code signing

    In the same configuration window as the last step, navigate to the Signing & Capabilities pane. Make sure Automatically manage signing is enabled and select your iOS development team from the Team field below it.

  5. 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 TangramSwiftSample workspace, navigate to TangramSwiftSample/Info.plist. In the Value field next to the NextzenApiKey key, enter your API key.

  6. Build and run from the Xcode Workspace

    In the TangramSwiftSample workspace, select your deployment target in the top-left corner and press the Play button to build and run the app.

  7. (Optional) Move your local app configuration to Local.xcconfig

    If 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 .gitignore and our Xcode project is configured to check this file for settings.

    Create a text file in the repository root named Local.xcconfig and add the following lines:

    DEVELOPMENT_TEAM = 
    PRODUCT_BUNDLE_IDENTIFIER = 
    NEXTZEN_API_KEY = 
    

    After completing the configuration steps above, run git diff on 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 checkout on any changed files.

About

Sample iOS app in Swift using Tangram ES

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published