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.
The ArcGIS Runtime SDK Samples app has a Target SDK version of 14.0, meaning that it can run on devices with iOS 14.0 or newer.
Building Samples Using Swift Package Manager
Fork and then clone the repository
Open the arcgis-ios-sdk-samples.xcodeprojproject 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.
Install the ArcGIS Runtime SDK for iOS by running the pod install command in the folder where you cloned this repository
Open the arcgis-ios-sdk-samples.xcworkspaceworkspace file
Select the arcgis-ios-sdk-samples project node, go to the Package Dependencies 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.
Run the arcgis-ios-sdk-samples app target
Building Samples Using Installed SDK
Fork and then clone the repository
Install the ArcGIS Runtime SDK for iOS to a central location on your mac as described here
Open the arcgis-ios-sdk-samples.xcodeprojproject file. Select the arcgis-ios-sdk-samples project node, go to the Package Dependencies tab, and delete the arcgis-runtime-toolkit-ios package
This Swift package conflicts with manual installation and is only required when using the Swift Package Manager as described in the previous section.
Download the arcgis-runtime-toolkit-ios from here, and follow the instructions to add it as a local Swift package
The manual installation method allows you to use a local installation ArcGIS Runtime SDK for iOS by making minor edits to the toolkit's Swift package manifest. Follow the instructions in Package.swift to uncomment the lines for localArcGISPackage and use it as the package dependency instead of the hosted version.
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 API key
To build this app locally, follow the steps to add an API key to a secrets file stored in the project's root directory, $(SRCROOT)/.secrets.
Create a hidden secrets file in the project's root directory.
touch .secrets
Add your API Key to the secrets file aforementioned. Adding an API key allows you to access a set of ready-to-use services, including basemaps. Acquire the keys from your dashboard. Visit the developer's website to learn more about API keys.
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
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.
请发表评论