Skip to content

Commit

Permalink
Merge pull request #158 from Esri/update12
Browse files Browse the repository at this point in the history
Update12
  • Loading branch information
mhdostal committed Aug 25, 2021
2 parents 90db275 + e002437 commit de6ebdb
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ disabled_rules:

trailing_whitespace:
ignores_empty_lines: true

excluded:
- Pods
2 changes: 1 addition & 1 deletion Documentation/AR/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Augmented reality (AR)

[![guide doc](https://img.shields.io/badge/Full_Developers_Guide-Doc-purple)](https://developers.arcgis.com/ios/latest/swift/guide/display-scenes-in-augmented-reality.htm) [![world-scale sample](https://img.shields.io/badge/World_Scale-Sample-blue)](https://developers.arcgis.com/ios/latest/swift/sample-code/collect-data-in-ar/) [![Tabletop sample](https://img.shields.io/badge/Tabletop-Sample-blue)](https://developers.arcgis.com/ios/latest/swift/sample-code/display-scenes-in-tabletop-ar/) [![Flyover sample](https://img.shields.io/badge/Flyover-Sample-blue)](https://developers.arcgis.com/ios/latest/swift/sample-code/explore-scenes-in-flyover-ar/)
[![guide doc](https://img.shields.io/badge/Full_Developers_Guide-Doc-purple)](https://developers.arcgis.com/ios/scenes-3d/display-scenes-in-augmented-reality/) [![world-scale sample](https://img.shields.io/badge/World_Scale-Sample-blue)](https://developers.arcgis.com/ios/swift/sample-code/collect-data-in-ar/) [![Tabletop sample](https://img.shields.io/badge/Tabletop-Sample-blue)](https://developers.arcgis.com/ios/swift/sample-code/display-scenes-in-tabletop-ar/) [![Flyover sample](https://img.shields.io/badge/Flyover-Sample-blue)](https://developers.arcgis.com/ios/swift/sample-code/explore-scenes-in-flyover-ar/)

Augmented reality experiences are designed to "augment" the physical world with virtual content that respects real world scale, position, and orientation of a device. In the case of Runtime, a SceneView displays 3D geographic data as virtual content on top of a camera feed which represents the real, physical world.

Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/Esri/arcgis-runtime-ios", .upToNextMinor(from: "100.11.0"))
.package(url: "https://github.com/Esri/arcgis-runtime-ios", .upToNextMinor(from: "100.12.0"))
],
targets: [
.target(
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To use Toolkit in your project:
* **[TimeSlider](Documentation/TimeSlider)** - Allows interactively defining a temporal range (i.e. time extent) and animating time moving forward or backward. Can be used to manipulate the time extent in a MapView or SceneView.

## Requirements
* [ArcGIS Runtime SDK for iOS](https://developers.arcgis.com/ios/) 100.11.0 (or higher)
* [ArcGIS Runtime SDK for iOS](https://developers.arcgis.com/ios/) 100.12.0 (or higher)
* Xcode 12.0 (or higher)

The *ArcGIS Runtime Toolkit for iOS* has a *Target SDK* version of *13.0*, meaning that it can run on devices with *iOS 13.0* or newer.
Expand All @@ -36,7 +36,7 @@ The *ArcGIS Runtime Toolkit for iOS* has a *Target SDK* version of *13.0*, meani
1. Open your project in Xcode
2. Go to *File* > *Swift Packages* > *Add Package Dependency* option
3. Enter `https://github.com/Esri/arcgis-runtime-toolkit-ios` as the package repository URL
4. Choose version 100.11.0 or a later version. Click Next. Only version 100.11.0 or newer supports Swift Package Manager.
4. Choose version 100.12.0 or a later version. Click Next. Only version 100.11.0 or newer supports Swift Package Manager.

Note: The Toolkit Swift Package adds the ArcGIS SDK Swift Package as a dependency so no need to add both separately. If you already have the ArcGIS SDK Swift Package delete that and just add the Toolkit Swift Package.

Expand All @@ -57,8 +57,6 @@ The *ArcGIS Runtime Toolkit for iOS* has a *Target SDK* version of *13.0*, meani
3. Add the *ArcGISToolkit* library in your app, by adding it to the Frameworks, Libraries, and Embedded Content section of the General pane for your app target. The *ArcGISToolkit* library contains the *ArcGIS Runtime SDK for iOS* library, so you don't need to add that separately.
4. Add `import ArcGIS` and `import ArcGISToolkit` in your source code and start using the toolkit components

Note: Support for Carthage has been dropped for v100.11.0.

## SwiftLint

Both the Toolkit and Examples app support SwiftLint. You can install SwiftLint from [here](https://github.com/realm/SwiftLint). It is not necessary to have it installed in order to build, but you will get a warning without it. The specific rules the linter uses can be found in the `swiftlint.yml` files in the `Toolkit` and `Examples` directories.
Expand Down
17 changes: 0 additions & 17 deletions Sources/ArcGISToolkit/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,6 @@
import Foundation
import UIKit

extension UIApplication {
func topViewController(_ controller: UIViewController? = UIApplication.shared.windows.first(where: { $0.isKeyWindow })?.rootViewController) -> UIViewController? {
if let navigationController = controller as? UINavigationController {
return topViewController(navigationController.visibleViewController)
}
if let tabController = controller as? UITabBarController {
if let selected = tabController.selectedViewController {
return topViewController(selected)
}
}
if let presented = controller?.presentedViewController {
return topViewController(presented)
}
return controller
}
}

#if !SWIFT_PACKAGE
// This is a workaround for cocoapods compatibility.
extension Bundle {
Expand Down
4 changes: 2 additions & 2 deletions Sources/ArcGISToolkit/JobManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public class JobManager: NSObject {
///
/// An `AGSJob`'s status is `.paused` when it is created from JSON. So any `AGSJob`s that have been reloaded from User Defaults will be in the `.paused` state.
///
/// See the [Tasks and Jobs](https://developers.arcgis.com/ios/latest/swift/guide/tasks-and-jobs.htm#ESRI_SECTION1_BA1D597878F049278CC787A1C04F9734)
/// See the [Tasks and Jobs](https://developers.arcgis.com/ios/programming-patterns/tasks-and-jobs/#pause-resume-or-cancel-a-job)
/// guide topic for more details.
///
/// - Parameters:
Expand Down Expand Up @@ -251,7 +251,7 @@ public class JobManager: NSObject {
///
/// This happens when the `JobManager` is initialized. All `AGSJob`s will be in the `.paused` state when first restored from JSON.
///
/// See the [Tasks and Jobs](https://developers.arcgis.com/ios/latest/swift/guide/tasks-and-jobs.htm#ESRI_SECTION1_BA1D597878F049278CC787A1C04F9734)
/// See the [Tasks and Jobs](https://developers.arcgis.com/ios/programming-patterns/tasks-and-jobs/#pause-resume-or-cancel-a-job)
/// guide topic for more details.
private func loadJobsFromUserDefaults() {
if let storedJobsJSON = UserDefaults.standard.dictionary(forKey: jobsDefaultsKey) {
Expand Down
22 changes: 18 additions & 4 deletions Sources/ArcGISToolkit/MeasureToolbar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ private enum MeasureToolbarMode {
case feature
}

public class MeasureToolbar: UIToolbar, AGSGeoViewTouchDelegate {
@available(iOSApplicationExtension, unavailable)
public class MeasureToolbar: UIToolbar, AGSGeoViewTouchDelegate, UnitsViewControllerDelegate {
// Exposed so that the user can customize the sketch editor styles.
// Consumers of the MeasureToolbar should not mutate the sketch editor state
// other than it's style.
Expand Down Expand Up @@ -462,7 +463,7 @@ public class MeasureToolbar: UIToolbar, AGSGeoViewTouchDelegate {
let navigationController = UINavigationController(rootViewController: unitsViewController)
navigationController.modalPresentationStyle = .formSheet

UIApplication.shared.topViewController()?.present(navigationController, animated: true)
topViewController()?.present(navigationController, animated: true)
}

/// Called in response to
Expand Down Expand Up @@ -671,9 +672,7 @@ public class MeasureToolbar: UIToolbar, AGSGeoViewTouchDelegate {
}
return nil
}
}

extension MeasureToolbar: UnitsViewControllerDelegate {
public func unitsViewControllerDidCancel(_ unitsViewController: UnitsViewController) {
unitsViewController.dismiss(animated: true)
}
Expand All @@ -689,4 +688,19 @@ extension MeasureToolbar: UnitsViewControllerDelegate {
fatalError("Unsupported unit type")
}
}

private func topViewController(_ controller: UIViewController? = UIApplication.shared.windows.first(where: { $0.isKeyWindow })?.rootViewController) -> UIViewController? {
if let navigationController = controller as? UINavigationController {
return topViewController(navigationController.visibleViewController)
}
if let tabController = controller as? UITabBarController {
if let selected = tabController.selectedViewController {
return topViewController(selected)
}
}
if let presented = controller?.presentedViewController {
return topViewController(presented)
}
return controller
}
}

0 comments on commit de6ebdb

Please sign in to comment.