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 #1177 from Esri/v.next
Browse files Browse the repository at this point in the history
Release 100.14.1.1
  • Loading branch information
vquach2404 authored Jun 17, 2022
2 parents 8e26956 + a2e23cf commit 67946e1
Show file tree
Hide file tree
Showing 37 changed files with 1,116 additions and 120 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ArcGIS Runtime SDK for iOS Samples [![](https://user-images.githubusercontent.com/2257493/54144188-6fe0fc00-43e8-11e9-8cf5-229af80f604a.png)](https://itunes.apple.com/us/app/arcgis-runtime-sdk-for-ios/id1180714771)
ArcGIS Runtime SDK for iOS Samples [![](https://user-images.githubusercontent.com/2257493/54144188-6fe0fc00-43e8-11e9-8cf5-229af80f604a.png)](https://apps.apple.com/us/app/arcgis-runtime-sdk-for-ios/id1180714771)
==========================

This repository contains Swift sample code demonstrating the capabilities of [ArcGIS Runtime SDK for iOS](https://developers.arcgis.com/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](https://itunes.apple.com/us/app/arcgis-runtime-sdk-for-ios/id1180714771) on your iOS device.
This repository contains Swift sample code demonstrating the capabilities of [ArcGIS Runtime SDK for iOS](https://developers.arcgis.com/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](https://apps.apple.com/us/app/arcgis-runtime-sdk-for-ios/id1180714771) on your iOS device.

![Samples app](SamplesApp.png)

Expand Down Expand Up @@ -29,7 +29,7 @@ The ```main``` branch of this repository contains samples configured for the lat
* [ArcGIS Runtime Toolkit for iOS](https://github.com/Esri/arcgis-runtime-toolkit-ios) 100.14.0 (or newer)
* Xcode 13.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.
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

Expand Down Expand Up @@ -99,7 +99,7 @@ Esri welcomes contributions from anyone and everyone. Please see our [guidelines

## Licensing

Copyright 2021 Esri
Copyright 2022 Esri

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
88 changes: 76 additions & 12 deletions arcgis-ios-sdk-samples.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

43 changes: 28 additions & 15 deletions arcgis-ios-sdk-samples/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
var splitViewController: UISplitViewController {
return window!.rootViewController as! UISplitViewController
}
var categoryBrowserViewController: ContentCollectionViewController {
return (splitViewController.viewControllers.first as! UINavigationController).viewControllers.first as! ContentCollectionViewController
var categoryBrowserViewController: CategoriesCollectionViewController {
return (splitViewController.viewControllers.first as! UINavigationController).viewControllers.first as! CategoriesCollectionViewController
}

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
splitViewController.presentsWithGesture = false
splitViewController.preferredDisplayMode = .allVisible
splitViewController.preferredDisplayMode = .oneBesideSecondary
let navigationController = splitViewController.viewControllers.last as! UINavigationController
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem
navigationController.topViewController!.navigationItem.leftItemsSupplementBackButton = true
Expand All @@ -51,6 +51,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
// Set license key and/or API key.
application.license()

// Create user defaults favorites array.
createUserDefaults()

return true
}

Expand Down Expand Up @@ -108,17 +111,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele

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 {
// Override tint color for `UIControl`s.
UIToolbar.appearance().tintColor = .accentColor
UISlider.appearance().tintColor = .accentColor
UITableViewCell.appearance().tintColor = .accentColor
UIProgressView.appearance().tintColor = .accentColor
UIButton.appearance(whenContainedInInstancesOf: [AGSCallout.self]).tintColor = .accentColor
}
}

// MARK: - Split view
Expand All @@ -133,7 +125,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele

func splitViewController(_ splitViewController: UISplitViewController, separateSecondaryFrom primaryViewController: UIViewController) -> UIViewController? {
if let navigationController = primaryViewController as? UINavigationController {
if navigationController.topViewController! is ContentCollectionViewController || navigationController.topViewController is ContentTableViewController {
if navigationController.topViewController! is CategoriesCollectionViewController || navigationController.topViewController is CategoryTableViewController {
let controller = splitViewController.storyboard!.instantiateViewController(withIdentifier: "DetailNavigationController") as! UINavigationController
controller.topViewController!.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem
controller.topViewController!.navigationItem.leftItemsSupplementBackButton = true
Expand All @@ -143,6 +135,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
return nil
}

// MARK: - User data

/// Stores the user's favorited samples.
func createUserDefaults() {
UserDefaults.standard.register(defaults: [
UserDefaults.favoriteSamplesKey: [String]()
])
}

// MARK: - Sample import

/// The URL of the content plist file inside the bundle.
Expand All @@ -164,6 +165,18 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
}
}

extension UserDefaults {
static let favoriteSamplesKey = "favoriteSamples"
var favoriteSamples: Set<String> {
get {
Set(stringArray(forKey: Self.favoriteSamplesKey)!)
}
set {
set(newValue.sorted(), forKey: Self.favoriteSamplesKey)
}
}
}

extension UIColor {
// Also used as global tint/accent color.
class var accentColor: UIColor { return UIColor(named: "AccentColor")! }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class ExploreScenesInFlyoverAR: UIViewController {
if let error = error {
self.presentAlert(error: error)
} else {
let location = AGSPoint(x: 2.8259, y: 41.9906, z: 200.0, spatialReference: .wgs84())
let camera = AGSCamera(location: location, heading: 190, pitch: 65, roll: 0)
let location = AGSPoint(x: 2.8262, y: 41.9857, z: 200.0, spatialReference: .wgs84())
let camera = AGSCamera(location: location, heading: 190, pitch: 90, roll: 0)
self.arView.originCamera = camera
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ class AuthenticateWithOAuthViewController: UIViewController {
AGSAuthenticationManager.shared().oAuthConfigurations.add(oAuthConfiguration)
}

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

// MARK: UIViewController

override func viewDidLoad() {
Expand All @@ -72,6 +67,13 @@ class AuthenticateWithOAuthViewController: UIViewController {
"AuthenticateWithOAuthViewController"
]
}

// Clearing the credential cache so sample go through authentication every time.
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
AGSAuthenticationManager.shared().oAuthConfigurations.remove(oAuthConfiguration)
AGSAuthenticationManager.shared().credentialCache.removeAllCredentials()
}
}

extension AuthenticateWithOAuthViewController: AGSAuthenticationManagerDelegate {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ class TokenAuthenticationViewController: UIViewController {
"TokenAuthenticationViewController"
]
}

// Clearing the credential cache so sample go through authentication every time.
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
AGSAuthenticationManager.shared().credentialCache.removeAllCredentials()
}
}
30 changes: 30 additions & 0 deletions arcgis-ios-sdk-samples/Content Display Logic/ContentPList.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>displayName</key>
<string>Favorites</string>
<key>children</key>
<array/>
</dict>
<dict>
<key>displayName</key>
<string>Maps</string>
Expand Down Expand Up @@ -316,6 +322,14 @@
<key>storyboardName</key>
<string>ShowDeviceLocationUsingIndoorPositioning</string>
</dict>
<dict>
<key>displayName</key>
<string>Set max extent</string>
<key>descriptionText</key>
<string>Limit the view of a map to a particular area.</string>
<key>storyboardName</key>
<string>SetMaxExtent</string>
</dict>
</array>
</dict>
<dict>
Expand Down Expand Up @@ -792,6 +806,14 @@
<key>displayName</key>
<string>Query related features from non-spatial table</string>
</dict>
<dict>
<key>storyboardName</key>
<string>ApplyUniqueValuesAlternateSymbols</string>
<key>descriptionText</key>
<string>Apply a unique value with alternate symbols at different scales.</string>
<key>displayName</key>
<string>Apply unique values with alternate symbols</string>
</dict>
</array>
</dict>
<dict>
Expand Down Expand Up @@ -1455,6 +1477,14 @@
<string>SanDiegoDetour</string>
</array>
</dict>
<dict>
<key>storyboardName</key>
<string>DisplayRouteLayer</string>
<key>descriptionText</key>
<string>Display a route layer and its directions using feature collection.</string>
<key>displayName</key>
<string>Display route layer</string>
</dict>
</array>
</dict>
<dict>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import UIKit

class ContentCollectionViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
class CategoriesCollectionViewController: UICollectionViewController, UICollectionViewDelegateFlowLayout {
@IBOutlet private var collectionViewFlowLayout: UICollectionViewFlowLayout!

/// The categories to display in the collection view.
Expand All @@ -27,7 +27,7 @@ class ContentCollectionViewController: UICollectionViewController, UICollectionV

private func addSearchController() {
// create the view controller for displaying the search results
let searchResultsController = storyboard!.instantiateViewController(withIdentifier: "ContentTableViewController") as! ContentTableViewController
let searchResultsController = storyboard!.instantiateViewController(withIdentifier: "CategoryTableViewController") as! CategoryTableViewController
let allSamples = categories.flatMap { $0.samples }
searchResultsController.allSamples = allSamples
searchResultsController.searchEngine = SampleSearchEngine(samples: allSamples)
Expand Down Expand Up @@ -72,8 +72,12 @@ class ContentCollectionViewController: UICollectionViewController, UICollectionV
cell.nameLabel.text = category.name.uppercased()

// icon
let image = UIImage(named: "\(category.name)_icon")
cell.iconImageView.image = image
if indexPath == IndexPath(row: 0, section: 0) {
cell.iconImageView.image = UIImage(systemName: "star.fill")
} else {
let image = UIImage(named: "\(category.name)_icon")
cell.iconImageView.image = image
}

// background image
let bgImage = UIImage(named: "\(category.name)_bg")
Expand All @@ -89,13 +93,20 @@ class ContentCollectionViewController: UICollectionViewController, UICollectionV
// MARK: - UICollectionViewDelegate

override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
// hide keyboard if visible
// Hide keyboard if visible.
view.endEditing(true)

let category = categories[indexPath.item]
let controller = storyboard!.instantiateViewController(withIdentifier: "ContentTableViewController") as! ContentTableViewController
controller.allSamples = category.samples
let controller = storyboard!.instantiateViewController(withIdentifier: "CategoryTableViewController") as! CategoryTableViewController
controller.title = category.name
// Filter and display the favorited samples.
if category.name == "Favorites" {
controller.allSamples = categories
.flatMap { $0.samples.filter(\.isFavorite) }
controller.isFavoritesCategory = true
} else {
// Otherwise, show all samples.
controller.allSamples = category.samples
}
show(controller, sender: self)
}

Expand Down
Loading

0 comments on commit 67946e1

Please sign in to comment.