ArcGIS Runtime SDK for iOS Samples

This repository contains Swift sample code demonstrating the capabilities of ArcGIS Runtime SDK for iOS and how to use them in your own app. The project can be opened in Xcode and run on a simulator or a device. Or you can download the app from the App Store on your iOS device.

The main branch of this repository contains samples configured for the latest available version of ArcGIS Runtime SDK for iOS. For samples configured for older versions of the SDK, look under the Releases tab for a specific version.

Features

  • Maps - Open, create, interact with and save maps
  • Layers - Display vector and raster data in maps and scenes
  • Features - Work with feature layers and geodatabases
  • Display Information - Show graphics, popups, callouts, and sketches
  • Search - Find addresses, places, and points of interest
  • Edit Data - Add, delete, and edit features and attachments
  • Geometry - Create geometries and perform geometric operations
  • Route & Directions - Calculate routes between locations and around barriers
  • Analysis - Perform spatial analysis via geoprocessing tasks and services
  • Cloud & Portal - Search for webmaps and list portal group users
  • Scenes - Visualize 3D environments and symbols
  • Utility Network - Work with utility networks, performing traces and exploring network elements
  • Augmented Reality - View data overlaid on the real world through your device's camera

Requirements

The ArcGIS Runtime SDK Samples app has a Target SDK version of 13.0, meaning that it can run on devices with iOS 13.0 or newer.

Building Samples Using Swift Package Manager

  1. Fork and then clone the repository
  2. Open the arcgis-ios-sdk-samples.xcodeproj project file

    The project has been configured to use the arcgis-runtime-toolkit-ios package, which provides the ArcGISToolkit framework as well as the ArcGIS framework.

  3. Run the arcgis-ios-sdk-samples app target

To add the Swift packages to your own projects, consult the documentation for the ArcGIS Runtime iOS Toolkit and ArcGIS Runtime iOS SDK.

Building Samples Using CocoaPods

  1. Fork and then clone the repository
  2. Install the ArcGIS Runtime SDK for iOS by running the pod install command in the folder where you cloned this repository
  3. Open the arcgis-ios-sdk-samples.xcworkspace workspace file
  4. Select the arcgis-ios-sdk-samples project node, go to the Swift Packages tab, and delete the arcgis-runtime-toolkit-ios package. This Swift package conflicts with CocoaPods and is only required when using the Swift Package Manager as described in the previous section.
  5. Run the arcgis-ios-sdk-samples app target

Sample Data

Some sample data is too large to store in the repository, so it is automatically downloaded at build time. The first time the app is built, a build script downloads the necessary data to Portal Data. The script only downloads data files that do not already exist, so subsequent builds will take significantly less time.

Configure App Secrets

As a best-practices principle, the project conceals app secrets from source code by generating and compiling an AppSecrets.swift source code file at build time using a custom build rule.

This build rule looks for a secrets file stored in the project's root directory, $(SRCROOT)/.secrets.

Note: Without licensing or licensing with invalid keys do not throw an exception, but simply fail to license the app, falling back to Developer Mode (which will display a watermark on the map and scene views).

  1. Create a hidden secrets file in the project's root directory.
touch .secrets
  1. Add your License Key to the secrets file. Licensing the app will remove the 'Licensed for Developer Use Only' watermark. Licensing the app is optional in development but required for production. Optionally add your Extension License Key and API Key to the secrets file if needed. Acquire license keys from your dashboard.
echo ARCGIS_LICENSE_KEY=your-license-key >> .secrets
echo ARCGIS_EXTENSION_LICENSE_KEY=your-extension-license-key >> .secrets
echo ARCGIS_API_KEY=your-api-key >> .secrets

Replace 'your-license-key', 'your-extension-license-key' and 'your-api-key' with your keys.

  1. Uncomment the line application.license() in AppDelegate.application(_:didFinishLaunchingWithOptions:), and choose the appropriate licensing method for your keys.

Visit the developer's website to learn more about Licensing your ArcGIS Runtime App and Security and authentication.

To learn more about masquerade, consult the documentation of Esri's Data Collection app.

GitHub

https://github.com/Esri/arcgis-runtime-samples-ios