Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1063 from Esri/v.next
Browse files Browse the repository at this point in the history
Release 100.11
  • Loading branch information
yo1995 authored Apr 22, 2021
2 parents f863edd + e2cc9a8 commit 77619fa
Show file tree
Hide file tree
Showing 90 changed files with 832 additions and 2,511 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,9 @@ xcuserdata/

## Portal Item Data
/Portal\ Data

## Swift Package Manager
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
Packages/
Package.pins
Package.resolved
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,3 @@ trailing_whitespace:

excluded:
- Pods
- arcgis-runtime-toolkit-ios
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,41 +25,34 @@ The ```main``` branch of this repository contains samples configured for the lat

## Requirements

* [ArcGIS Runtime SDK for iOS](https://developers.arcgis.com/ios/) 100.10.0 (or newer)
* [ArcGIS Runtime Toolkit for iOS](https://github.com/Esri/arcgis-runtime-toolkit-ios) 100.10.0 (or newer)
* [ArcGIS Runtime SDK for iOS](https://developers.arcgis.com/ios/) 100.11.0 (or newer)
* [ArcGIS Runtime Toolkit for iOS](https://github.com/Esri/arcgis-runtime-toolkit-ios) 100.11.0 (or newer)
* Xcode 12.0 (or newer)

The *ArcGIS Runtime SDK Samples app* has a *Target SDK* version of *12.0*, meaning that it can run on devices with *iOS 12.0* or newer.
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 installed SDK
## Building Samples Using Swift Package Manager

1. **Fork** and then **clone** the repository
> Make sure to use the "recursive" option to ensure you get the **ArcGIS Runtime Toolkit** submodule
>
>`git clone --recursive [URL to Git repo]`
>
> If you've already cloned the repo without the submodule, you can load the submodule using
>
>`git submodule update --init`
1. **Install** the ArcGIS Runtime SDK for iOS to a central location on your Mac as described [here](https://developers.arcgis.com/ios/get-started)
1. **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.
1. **Run** the `arcgis-ios-sdk-samples` app target
> If you get the error message saying _"This Copy Files build phase contains a reference to a missing file 'ArcGISToolkit.framework'"_, you probably didn't clone the repo to include it's submodule. See Step 1 above.

## Building samples with CocoaPods
> To add the Swift packages to your own projects, consult the documentation for the [ArcGIS Runtime iOS Toolkit](https://github.com/Esri/arcgis-runtime-toolkit-ios/#swift-package-manager) and [ArcGIS Runtime iOS SDK](https://github.com/Esri/arcgis-runtime-ios#instructions).
## Building Samples Using CocoaPods

1. **Fork** and then **clone** the repository
1. **Install** the ArcGIS Runtime SDK for iOS by running the `pod install` command in the folder where you cloned this repository
1. **Open** the `arcgis-ios-sdk-samples.xcworkspace` **workspace** file
1. **Select** the `arcgis-ios-sdk-samples` project node, go to the `Build Phases` tab, and **delete** the phases for `Embed Frameworks`. (This phase conflicts with CocoaPods and is only required when using the installed SDK as described in the previous section)
1. **Select** the `ArcGISToolkit.xcodeproj` project node and **delete** it. (this project dependency conflicts with CocoaPods and is only required when using the installed SDK as described in the previous section)
1. **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.
1. **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
## 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.

Expand Down
201 changes: 67 additions & 134 deletions arcgis-ios-sdk-samples.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ class AnalyzeHotspotsViewController: UIViewController, HotspotSettingsViewContro
// start job
geoprocessingJob.start(statusHandler: { (status: AGSJobStatus) in
// show progress hud with job status
SVProgressHUD.show(withStatus: status.statusString())
UIApplication.shared.showProgressHUD(message: status.statusString())
}, completion: { [weak self] (result: AGSGeoprocessingResult?, error: Error?) in
// dismiss progress hud
SVProgressHUD.dismiss()
UIApplication.shared.hideProgressHUD()
guard let self = self else { return }
if let error = error {
// show error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ class ViewshedGeoprocessingViewController: UIViewController, AGSGeoViewTouchDele
newFeature.geometry = point

// show progress hud
SVProgressHUD.show(withStatus: "Adding Feature")
UIApplication.shared.showProgressHUD(message: "Adding Feature")

// add the new feature to the feature collection table
featureCollectionTable.add(newFeature) { [weak self] (error: Error?) in
// dismiss progress hud
SVProgressHUD.dismiss()
UIApplication.shared.hideProgressHUD()

if let error = error {
// show error
Expand All @@ -114,10 +114,10 @@ class ViewshedGeoprocessingViewController: UIViewController, AGSGeoViewTouchDele
// start the job
geoprocessingJob.start(statusHandler: { (status: AGSJobStatus) in
// show progress hud with job status
SVProgressHUD.show(withStatus: status.statusString())
UIApplication.shared.showProgressHUD(message: status.statusString())
}, completion: { [weak self] (result: AGSGeoprocessingResult?, error: Error?) in
// dismiss progress hud
SVProgressHUD.dismiss()
UIApplication.shared.hideProgressHUD()

guard let self = self else {
return
Expand Down
53 changes: 20 additions & 33 deletions arcgis-ios-sdk-samples/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
var categoryBrowserViewController: ContentCollectionViewController {
return (splitViewController.viewControllers.first as! UINavigationController).viewControllers.first as! ContentCollectionViewController
}

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
if url.absoluteString.range(of: "auth", options: [], range: nil, locale: nil) != nil {
AGSApplicationDelegate.shared().application(app, open: url, options: options)
}
return true
}


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
// Override point for customization after application launch.
let splitViewController = self.window!.rootViewController as! UISplitViewController
Expand All @@ -55,33 +48,31 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
// Enable/disable touches based on settings.
self.setTouchPref()

SVProgressHUD.setDefaultMaskType(.gradient)

// Uncomment the following line to set license key.
// application.license()

return true
}

func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
self.setTouchPref()
}

func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
Expand All @@ -103,25 +94,21 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
// MARK: - Appearance modification

func modifyAppearance() {
let navigationBarAppearance = UINavigationBarAppearance()
navigationBarAppearance.configureWithTransparentBackground()
navigationBarAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
navigationBarAppearance.titleTextAttributes = [.foregroundColor: UIColor.white]
navigationBarAppearance.backgroundColor = .accentColor

let navigationBarAppearanceProxy = UINavigationBar.appearance()
if #available(iOS 13.0, *) {
let navigationBarAppearance = UINavigationBarAppearance()
navigationBarAppearance.configureWithTransparentBackground()
navigationBarAppearance.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
navigationBarAppearance.titleTextAttributes = [.foregroundColor: UIColor.white]
navigationBarAppearance.backgroundColor = .accentColor

navigationBarAppearanceProxy.standardAppearance = navigationBarAppearance
navigationBarAppearanceProxy.compactAppearance = navigationBarAppearance
navigationBarAppearanceProxy.scrollEdgeAppearance = navigationBarAppearance
} else {
navigationBarAppearanceProxy.largeTitleTextAttributes = [.foregroundColor: UIColor.white]
navigationBarAppearanceProxy.titleTextAttributes = [.foregroundColor: UIColor.white]
navigationBarAppearanceProxy.barTintColor = .accentColor
}
UISwitch.appearance().onTintColor = .accentColor
navigationBarAppearanceProxy.standardAppearance = navigationBarAppearance
navigationBarAppearanceProxy.compactAppearance = navigationBarAppearance
navigationBarAppearanceProxy.scrollEdgeAppearance = navigationBarAppearance
navigationBarAppearanceProxy.tintColor = .white

UISwitch.appearance().onTintColor = .accentColor
UIView.appearance(whenContainedInInstancesOf: [UIAlertController.self]).tintColor = .accentColor

if #available(iOS 14.0, *) {
// Nothing to do! iOS 14 handles global tint with accent color.
} else {
Expand All @@ -133,9 +120,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
UIButton.appearance(whenContainedInInstancesOf: [AGSCallout.self]).tintColor = .accentColor
}
}

// MARK: - Split view

func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool {
if secondaryViewController.restorationIdentifier == "DetailNavigationController" {
return true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ class NavigateARNavigatorViewController: UIViewController {
@IBAction func startTurnByTurn(_ sender: UIBarButtonItem) {
routeTracker = AGSRouteTracker(routeResult: routeResult, routeIndex: 0, skipCoincidentStops: true)
if routeTask.routeTaskInfo().supportsRerouting {
routeTracker?.enableRerouting(with: routeTask, routeParameters: routeParameters, strategy: .toNextStop, visitFirstStopOnStart: true ) { [weak self] (error: Error?) in
let reroutingParameters = AGSReroutingParameters(routeTask: routeTask, routeParameters: routeParameters)!
routeTracker?.enableRerouting(with: reroutingParameters) { [weak self] error in
if let error = error {
self?.presentAlert(error: error)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ class NavigateARRoutePlannerViewController: UIViewController {

// MARK: Instance properties

/// The route task that solves the route using the online routing service, with authentication required.
let routeTask = AGSRouteTask(url: URL(string: "https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World")!)
/// The route task that solves the route using the online routing service, using API key authentication.
let routeTask = AGSRouteTask(url: URL(string: "https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World")!)
/// The parameters for route task to solve a route.
var routeParameters: AGSRouteParameters!
/// The data source to track device location and provide updates to location display.
Expand All @@ -56,13 +56,6 @@ class NavigateARRoutePlannerViewController: UIViewController {
return overlay
}()

/// An OAuth2 configuration to access online routing service.
let oAuthConfiguration = AGSOAuthConfiguration(
portalURL: URL(string: "https://www.arcgis.com")!,
clientID: "lgAdHkYZYlwwfAhC",
redirectURL: "my-ags-app://auth"
)

/// An `AGSPoint` representing the start of navigation.
var startPoint: AGSPoint? {
didSet {
Expand Down Expand Up @@ -156,10 +149,6 @@ class NavigateARRoutePlannerViewController: UIViewController {
// Avoid overlapping status label and map content.
mapView.contentInset.top = 2 * statusLabel.font.lineHeight

// Configure the authentication manager to show the OAuth dialog.
AGSAuthenticationManager.shared().delegate = self
AGSAuthenticationManager.shared().oAuthConfigurations.add(oAuthConfiguration)

routeTask.load { [weak self] (error: Error?) in
guard let self = self else { return }
if let error = error {
Expand Down Expand Up @@ -199,11 +188,6 @@ class NavigateARRoutePlannerViewController: UIViewController {
}
}
}

deinit {
AGSAuthenticationManager.shared().oAuthConfigurations.remove(oAuthConfiguration)
AGSAuthenticationManager.shared().credentialCache.removeAllCredentials()
}
}

// MARK: - Set route start and end on touch
Expand All @@ -226,16 +210,3 @@ extension NavigateARRoutePlannerViewController: AGSGeoViewTouchDelegate {
}
}
}

// MARK: - Show OAuth dialog for route service

extension NavigateARRoutePlannerViewController: AGSAuthenticationManagerDelegate {
func authenticationManager( _ authenticationManager: AGSAuthenticationManager, wantsToShow viewController: UIViewController) {
viewController.modalPresentationStyle = .overFullScreen
present(viewController, animated: true)
}

func authenticationManager(_ authenticationManager: AGSAuthenticationManager, wantsToDismiss viewController: UIViewController) {
dismiss(animated: true)
}
}
16 changes: 10 additions & 6 deletions arcgis-ios-sdk-samples/Augmented reality/Navigate in AR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,19 @@ When you start, route instructions will be displayed and spoken. As you proceed

## About the data

This sample uses Esri's [World Elevation](https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer) service to ensure that route lines are placed appropriately in 3D space. It uses Esri's [World Route](https://www.arcgis.com/home/item.html?id=1feb41652c5c4bd2ba5c60df2b4ea2c4) service to calculate routes. The world routing service requires authentication and does consume ArcGIS Online credits.
This sample uses Esri's [World Elevation](https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer) service to ensure that route lines are placed appropriately in 3D space. It uses Esri's [World Route](https://www.arcgis.com/home/item.html?id=1feb41652c5c4bd2ba5c60df2b4ea2c4) service to calculate routes.

**Note:** This item requires an ArcGIS Online organizational subscription or an ArcGIS Developer account and consumes credits.
**Note:** This routing service requires one of the following authentication methods:

To access this sample, you'll need to do one of the following:
* An ArcGIS Online organizational subscription and credits
* An ArcGIS Developer account and credits
* An API key

* Sign in with an account that is a member of an organizational subscription.
* Sign in with a developer account.
* Register an application and use your application's credentials.
To access the routing service with ArcGIS identity/named user login using OAuth workflow, please read more at [ArcGIS Identity](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/).

The routing service can also be accessed with an API key. Please read more at [API keys](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/api-keys/).

Learn more about [security and authentication on ArcGIS Developers website](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/).

## Additional information

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class IntegratedWindowsAuthenticationPortalMapBrowserViewController: UITableView

/// Shows an activity indicator in the center of the table view.
func showActivityIndicator() {
let activityIndicatorView = UIActivityIndicatorView(style: .gray)
let activityIndicatorView = UIActivityIndicatorView(style: .medium)
activityIndicatorView.translatesAutoresizingMaskIntoConstraints = false
activityIndicatorView.startAnimating()

Expand Down
Loading

0 comments on commit 77619fa

Please sign in to comment.