- Features
- Best practices
- Detailed documentation
- Get started
- Learn More
- Requirements
- Contributing
- MDTOC
- Licensing
Data Collection for iOS shows how a robust application can be built around the ArcGIS Platform using the ArcGIS Runtime SDK for iOS and Swift. It demonstrates best practices around some simple but key functionality of the ArcGIS Runtime. Using your organization's web maps, you can use Data Collection as is, or extend it to meet your specific needs.
Map | Portal | Pop-up | Attachments |
---|---|---|---|
Collect | Map Content | Bookmarks | Layers |
---|---|---|---|
- Taking your web map and data offline
- Editing your data both offline and online
- Synchronizing offline edits
- Viewing and editing your data with Popups
- Working with Features, Popups and PopupManagers
- Editing and querying Feature Tables
- Working with related records
- Identifying map features
- Portal authentication with OAuth
- Using the World Geocoder service
- Using Popup configuration to drive app behavior
The project also demonstrates some patterns for building real-world apps around the ArcGIS Runtime SDK.
- Map-centric UI design
- ArcGIS asynchronous service pattern
- Swift class extensions
- Swift KVO & NotificationCenter state handling
Read the docs for a detailed explanation of the application, including its architecture and how it leverages the ArcGIS platform, as well as how you can begin using the app right away.
Make sure you've installed Xcode and the ArcGIS Runtime SDK for iOS and that they meet these requirements.
Fork the Data Collection repo.
Once you have forked the repo, make a clone.
git clone --recursive [URL to forked Git repo]
Make sure to use the "recursive" option to ensure you get the ArcGIS Runtime Toolkit submodule
If you've already cloned the repo without the submodule, you can load the submodule using
git submodule update --init
Change into the root repo directory.
cd data-collection-ios
The project uses a bash program named masquerade
in a custom build rule to conceal app secrets in versioned source code. Grant masquerade
executable permissions.
chmod +rwx data-collection/scripts/masquerade
To learn more about masquerade
, consult the app's documentation.
If you make changes in the fork and would like to sync those changes with the upstream repository, you must first configure the remote. This will be required when you have created local branches and would like to make a pull request to your upstream branch.
- Specify a new remote upstream repository that will be synced with the fork.
git remote add upstream https://github.com/Esri/data-collection-ios.git
- Verify the new upstream is added.
git remote -v
If there are changes made in the original repository, you can sync the fork to keep it updated with upstream repository.
-
In the terminal,
cd
to your local project repo. -
Fetch the commits from the upstream repository.
git fetch upstream
- Checkout your fork's local master branch.
git checkout master
- Sync your local
master
branch withupstream/master
.
git merge upstream/master
Note, your local changes will be retained and your fork's master branch will be in sync with the upstream repository.
The app uses OAuth to authenticate users to a web map hosted in your ArcGIS Portal. Register an application with the developers website to broker authentication between the app and your Portal.
- Log in to developers.arcgis.com with either your ArcGIS Organizational Account or an ArcGIS Developer Account.
- Visit your dashboard and create a new application.
- Click the 'Authentication' tab.
- Note the Client ID, we'll use it in a future step.
- Add a new Redirect URI,
data-collection://auth
The Client ID configures the ArcGIS Runtime to show your users, during the login process, that the application was built by you and can be trusted.
The Redirect URL configures the OAuth process to then return to your app once authentication is complete.
Configure the project to access your organization's Portal and web map.
If you would like to run the application using a demo data set maintained by Esri, you can ignore this step.
- Open the project named
data-collection.xcodeproj
in Xcode. - Browse to the file named
AppConfiguration.swift
located in the directory nameddata-collection
. - Configure the app with your organization's base portal domain by modifying the value of the property named
basePortalDomain
. - Configure the app with your organization's web map by modifying the value of the property named
webMapItemID
.
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 directory, $(PROJECT_DIR)/.secrets
.
- Create a hidden secrets file in the project's root directory.
touch data-collection/.secrets
- Add your registered app's Client ID to the secrets file.
echo ARCGIS_CLIENT_ID=your-client-id >> data-collection/.secrets
Replace 'your-client-id' with your app's Client ID.
- Optionally add your License Key to the secrets file. Licensing the app will remove the 'Licensed for Development' watermark. Licensing the app is optional in development but required for production. Acquire your license key from your dashboard.
echo ARCGIS_LICENSE_KEY=your-license-key >> data-collection/.secrets
Replace 'your-license-key' with your License Key.
A Lite license is free and enables most of the capabilities required by this app, with the exception of offline editing and synchronizing offline edits back to a feature service. For offline editing and synchronizing, you need a Basic license. Visit the developer's website to learn more about licensing your ArcGIS Runtime app and the different ArcGIS Runtime license levels.
To learn more about masquerade
, consult the app's [documentation]](./docs#app-configuration).
Learn more about Esri open source apps here.
- Xcode 12 and Swift 5
- ArcGIS Runtime SDK for iOS, version 100.11 or later.
- ArcGIS Runtime Toolkit for iOS, version 100.11 or later.
- To edit records or take a web map offline you will need an ArcGIS Online Organizational account, an ArcGIS Online Developer account or an ArcGIS Online account authenticated using a social login.
- To consume your own web map you will need an ArcGIS Online Organizational account.
- Device or Simulator running iOS 13.0 or later.
Anyone and everyone is welcome to contribute. We do accept pull requests.
Generation of this and other document's table of contents in this repository was performed using the MDTOC package for Atom.
Copyright 2018 Esri
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
A copy of the license is available in the repository's LICENSE file.
For information about licensing your deployed app, see License your app.
Some great open source components are available out there for iOS developers. The following have been used in this project, with much gratitude to their authors.
- SVProgressHUD is licensed under the MIT License.
- Alamofire/NetworkReachabilityManager is licensed under the MIT License.