Giter VIP home page Giter VIP logo

arcgis-runtime-toolkit-ios's Introduction

ArcGIS Runtime Toolkit for iOS

doc CocoaPods SPM

The ArcGIS Runtime SDK for iOS Toolkit contains components that will simplify your iOS app development. Check out the Examples project to see these components in action or read through the Documentation to learn more about them.

Try ArcGIS Maps SDK for Swift version 200

ArcGIS Runtime SDK for iOS version 100.15 is a long-term support release focused exclusively on bug fixes and minor updates.

ArcGIS Maps SDK for Swift version 200 builds on the proven architecture of 100.15, and provides a new API designed exclusively for developing iOS apps using Swift - Apple's modern, powerful, and intuitive programming language.

To use Toolkit in your project:

Toolkit Components

  • Augmented reality (AR) - Integrates the scene view with ARKit to enable augmented reality (AR).
  • Bookmarks - Shows bookmarks, from a map, scene, or a list.
  • Compass - Shows a compass direction when the map is rotated. Auto-hides when the map points north up.
  • FloorFilter - Allows to filter floor plan data in a geo view by a site, a building in the site, or a floor in the building.
  • JobManager - Suspends and resumes ArcGIS Runtime tasks when the app is background, terminated, and relaunched.
  • LegendViewController - Displays a legend for all the layers in a map or scene contained in an AGSGeoView.
  • MeasureToolbar - Allows measurement of distances and areas on the map view.
  • PopupController - Display details and media, edit attributes, geometry and related records, and manage the attachments of features and graphics (popups are defined in the popup property of features and graphics).
  • Scalebar - Displays current scale reference.
  • TemplatePickerViewController - Allows a user to choose a template from a list of AGSFeatureTemplate when creating new features.
  • 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

The ArcGIS Runtime Toolkit for iOS has a Target SDK version of 14.0, meaning that it can run on devices with iOS 14.0 or newer.

Instructions

Swift Package Manager

  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.15.0 or a later version. Click Next.

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.

New to Swift Package Manager? Visit swift.org/package-manager/.

Cocoapods

  1. Add pod 'ArcGIS-Runtime-Toolkit-iOS' to your podfile
  2. Run pod install. This will download the toolkit and the ArcGIS Runtime SDK for iOS which the toolkit depends upon and then configure your project to reference them both
  3. Add import ArcGISToolkit in your source code and start using the toolkit components

New to cocoapods? Visit cocoapods.org

Manual

  1. Clone or download this repo
  2. Drag and Drop the arcgis-runtime-toolkit-ios folder into your project through the Xcode Project Navigator pane
  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: The manual installation method also allows you to use a local installation ArcGIS Runtime SDK for iOS by making minor edits to the swift package.

Configure API Key

Some of the toolkit components and examples utilize a set of ready-to-use ArcGIS Platform services, including basemaps, and therefore require an API Key to be set in AppDelegate.swift. Please see the setup guide for more information.

SwiftLint

Both the Toolkit and Examples app support SwiftLint. You can install SwiftLint from here. 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.

Additional Resources

Issues

Find a bug or want to request a new feature? Please let us know by submitting an issue.

Contributing

Esri welcomes contributions from anyone and everyone. Please see our guidelines for contributing.

Licensing

Copyright 2017 - 2022 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.

arcgis-runtime-toolkit-ios's People

Contributors

alpascual avatar chri7325 avatar dfeinzimer avatar dg0yal avatar mhdostal avatar ncastle1 avatar nixta avatar njarecha avatar philium avatar rolson avatar zkline101 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arcgis-runtime-toolkit-ios's Issues

JobManager sample not taking advantage of background fetch

We need to augment the JobManager sample to take advantage of background fetch. It was meant to do that, however I believe the code was lost in a merge at some point. See documentation here:

 For supporting background fetch you can forward the call from your AppDelegate's
 `func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping` 
 function, to the same function in this class.

Scalebar: Working with Coalescer & Etc.

It would be nice to incorporate the scale-bar attributes & behavior into a future SDK as an integral feature of the map view. It's a hassle to having to deal with the over-sampling of the map via KVO (ref: coalescer) in code.....should be within the SDK.

AR not working on iOS 12 devices

When running the demo app on iOS 12 devices, the AR sample is not showing the camera feed.
It does work on iOS 13 devices.

How can I get them to work?

PopupController Example: initial size of added attachment images in incorrect

In the PopupController Example, adding an image attachment (via "Choose From Library") to either a new or existing feature results in the size displaying as "-1.0 bytes". Saving the feature and reselecting it causes the attachment sizes to display correctly.

Adding an attachment directly from a new image (via "Take Photo or Video"), displays the correct size.

Steps to reproduce:

  • In the PopupController example, tap an existing feature
  • Tap the "Attached" segment/tab to view attachments and then start editing via the "Edit" button
  • Tap "Add Attachment" and select "Choose From Library"
  • Select an image from the Library and give it the default name.
  • Notice the size says: "-1.0 bytes".

After adding attachments (note that "Photo3.jpg" was a new image from the camera and displays the correct size):

image

After saving the feature, going back to the map, and re-selecting the same feature results in correct sizes:

image

The initial sizes should appear correctly immediately after adding the attachment.

Built using Xcode 12.5 and v100.12 of the ArcGIS Runtime SDK.
Run on an iPhone 8 with iOS v14.7.1
Also occurs in the Simulator (iPad Pro 9.7" iOS 14.5)

ArcGIS Portal Authentication with Biometrics

It would be very convenient to Authenticate against your Portal with Biometrics. I think this could be accomplished as a thin wrapper over the AGSPortal in workflow similar to this:

  • instantiate an AGSPortal with url and login required.
    • After the user logs in for the first time, make sure a credential cache is stored in Keychain.
  • Next time the user needs to login, Biometrics can be used using LocalAuthentication to check if fingerprint/face ID is supported and enabled on the device with LAContext.
  • If the touch ID/face ID authentication was successful, fetch the credentials from the Keychain and login, otherwise allow the user to try again or sign in manually with their username and password.

The path to xcframework should be absolute

E4E7E579255C5193002458B9 /* ArcGIS.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ArcGIS.xcframework; path = $HOME/Library/SDKs/ArcGIS/Frameworks/ArcGIS.xcframework; sourceTree = "<group>"; };

Otherwise it links to a wrong path, which cause the sample viewer unable to build. ref: Esri/arcgis-runtime-samples-ios#984 (comment)

Remove usage of BasemapType and Basemap static initializers in favor of BasemapStyles

The following methods have been deprecated in the ArcGIS Runtime SDK for iOS. They need to be replaced in all code and documentation by the appropriate "basemap styles" initializers.

AGSMap

- (instancetype)initWithBasemapType:(AGSBasemapType)basemapType
                           latitude:(double)latitude
                          longitude:(double)longitude
                      levelOfDetail:(NSInteger)levelOfDetail __deprecated_msg("Use 'AGSMap#initWithBasemapStyle:'");
+ (instancetype)mapWithBasemapType:(AGSBasemapType)basemapType
                          latitude:(double)latitude
                         longitude:(double)longitude
                     levelOfDetail:(NSInteger)levelOfDetail __deprecated_msg("Use 'AGSMap#mapWithBasemapStyle:'");

AGSScene

- (instancetype)initWithBasemapType:(AGSBasemapType)basemapType __deprecated_msg("Use 'AGSScene#initWithBasemapStyle:'.");
+ (instancetype)sceneWithBasemapType:(AGSBasemapType)basemapType __deprecated_msg("Use 'AGSScene#sceneWithBasemapStyle:'.");

AGSBasemap

  • The AGSBasemapType enumeration and all static AGSBasemap initializers based on ArcGIS Online types.

Add moving graphics

I need to show a graphic moving between two coordinates, please suggest me how to implement it.

Table of Contents in ArcGIS Runtime Toolkit

We would like to have a TOC sample using the SDK 100.2.1 that could:

  1. turn layers on/off including operational layers, basemaplayers, tile package layers and runtime database layers, etc.
  2. layers can be expanded to show layer legends/feature templates.
  3. Our current TOC is built based on the previous TOC sample in the SDK 10.2.x. If a feature template from a feature service or an offline database is tapped, it puts the map into editing mode and then feature geometry can be sketched and new feature can be created and saved.

Missing CompassIcon

CompassIcon is missing and as a result, nothing is being displayed on a screen. It's a little frustrating to find out the reason for that behaviour. Can anyone add a sample compass icon?

Unable to select plane when switching from tabletop to tabletop sample

I think that when selecting a scene, the planeDetection mode is cleared. When you then select a new tabletop sample, I don't think it's set up again, so I'm unable to place the scene.

It might be user error, but I've never been able to place a tabletop scene after having previously used a tabletop scene.

Possible NorthArrow?

Hey team. I've implemented a North Arrow, but before I tidy it up, get a code review and integrate it to the Xcode project to make a PR, I wanted to make sure it would be useful and is close enough to what we're looking for.

Features:

  • Interface Builder/Storyboard friendly. Wire up an AGSMapView in Storyboard.
  • Based of UIImageView. Just design in Storyboard and go.
  • Toggle to auto-hide when map view rotation is 0 (IBDesignable).
  • Toggle to control tap-to-north functionality (IBDesignable).

Some of this is taken from Ryan's sample, some from https://github.com/Esri/map-northarrow-ios

import UIKit
import ArcGIS

public class NorthArrowView: UIImageView {

    @IBOutlet weak var mapView: AGSMapView? {
        didSet {
            if let mapView = mapView {
                // Add NorthArrowController as an observer of the mapView's rotation.
                mapView.addObserver(self, forKeyPath: #keyPath(AGSMapView.rotation), options: [.new], context: &kvoContext)
            } else {
                mapView?.removeObserver(self, forKeyPath: #keyPath(AGSMapView.rotation))
            }
            setVisibilityFromMapView()
        }
    }

    private var kvoContext = 0
    
    lazy var tapGesture:UITapGestureRecognizer = {
        let r = UITapGestureRecognizer(target: self, action: #selector(resetNorth))
        return r
    }()
    
    @IBInspectable
    var autoHide:Bool = true
    
    @IBInspectable
    var tapForNorth:Bool = true {
        didSet {
            self.isUserInteractionEnabled = tapForNorth
            
            if self.isUserInteractionEnabled {
                self.addGestureRecognizer(tapGesture)
            } else {
                self.removeGestureRecognizer(tapGesture)
            }
        }
    }
    
    // Track any alpha override that may have been set in the Storyboard.
    private var maxAlpha:CGFloat = -1
    
    func resetNorth() {
        self.mapView?.setViewpointRotation(0, completion: nil)
    }
    
    func setVisibilityFromMapView(animate:Bool = false) {
        guard autoHide else {
            self.isHidden = false
            return
        }
        
        if !isHidden && maxAlpha < 0 {
            // Remember this for when we re-show. Could be non-zero from the Storyboard.
            maxAlpha = alpha
        }
        
        let duration = animate ? 0.25 : 0
        
        if self.mapView?.rotation != 0 {
            // Show if there's a MapView and rotation <> 0
            self.isHidden = false
            UIView.animate(withDuration: duration, animations: {
                self.alpha = self.maxAlpha
            })
        } else {
            UIView.animate(withDuration: duration, animations: {
                self.alpha = 0
            }, completion: { _ in
                self.isHidden = true
            })
        }
    }
    
    override public func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
        if (keyPath == #keyPath(AGSMapView.rotation)) && (context == &kvoContext) {
            // Rotate north arrow to match the map view rotation.
            let mapRotation = self.degreesToRadians(degrees: (360 - (self.mapView?.rotation ?? 0)))
            let transform = CGAffineTransform(rotationAngle: mapRotation)
            self.transform = transform

            setVisibilityFromMapView(animate: true)
        }
        else {
            super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
        }
    }
    
    func degreesToRadians(degrees : Double) -> CGFloat {
        return CGFloat(degrees * Double.pi / 180)
    }
}

Build errors with Xcode 13 Beta 3

With the latest beta of Xcode 13, while building sampleViewer, we get this following error with the toolkit Extensions.swift and MeasureToolbar.swift files

'shared' is unavailable in application extensions for iOS: Use view controller based solutions where appropriate instead.

2021-07-20 at 3 51 PM

SwiftLint not run with Swift package

image

I spotted some linter warnings from the toolkit source files. I realized that with the Swift package manifest setup, it is different than an Xcode project file where we can place a shell script in its Build Phases. Is this already taken into consideration?

One of the linter warning example โš ๏ธ Closure Opening Space Violation: Use one space between the brace and bracket. (closure_opening_space)

rotationObservation = mapView.observe(\.rotation, options: .new) {[weak self] (_, change) in

Update PopupController README

Clarifying that the user has to add Photo Privacy settings in the .plist to add photo attachments might be helpful because if they don't the app will crash when trying to add attachments.

Revert Xcode 13 Beta 3 build error fixes.

A change was put in forthis issue regarding Xcode 13 Beta 3. With Xcode 13 Beta 5, the change which caused the build issue has been reverted:

image

This issue is to revert the changes the associated PR

Installing arcgis-runtime-toolkit-ios via Cocoapods does not reflect newest toolkit items

adding:

pod 'ArcGIS-Runtime-Toolkit-iOS'

to my Podfile does not download the latest toolkit release but instead the (100.1.0) version.

Additionally, the Cocoapods pod documentation reflect documentation as of 100.1.0:
http://cocoadocs.org/docsets/ArcGIS-Runtime-Toolkit-iOS/100.1.0/

Also, a user will not be able to download the latest ArcGIS-Runtime-SDK-iOS cocoapod version 100.2.1 because this cocoapod depends on a specific minor version:

    ArcGIS-Runtime-Toolkit-iOS was resolved to 100.1.0, which depends on
      ArcGIS-Runtime-SDK-iOS (~> 100.1.0)

ArcGISARView performance problems

ArcGISARView frame rate drops when device pitch is changed (horizontal) - blocking sceneView.renderFrame() call takes more than 1 second

Suggestions for the time slider

Samples team has added a new sample featuring the time slider. A few suggestions came up during the PR process that we'd like to share:

  • implement with init?(coder:) so the time slider can be used in the storyboard. See Phil's comment for more info
  • support dark mode. See Ting's comment for more info

TableViewCell size inconsistent in PopupExample

When the PopupController component displays attributes of the selected feature, sometimes the table view cells are too large and don't contract to fit the existing content in the cells. Also, the sizing can sometimes change when scrolling. This happens for both text-based attributes and boolean (yes/no) attributes. It happens in both normal and "Edit" mode and with empty and non-empty cells.

Testing using Toolkit v100.8.0 and ArcGIS Runtime SDK for iOS v100.8.0.
Xcode v11.4.1

Simulator Screen Shot - iPhone 11 - 2020-08-17 at 15 11 38
Simulator Screen Shot - iPhone 11 - 2020-08-17 at 15 11 24

Toolkit enhancement proposal: Swift CustomStringConvertible and CustomDebugStringConvertible for AGS Objective-C Enums

I would like to introduce a swift toolkit enhancement that would adhere AGS enums to the swift CustomStringConvertible and CustomDebugStringConvertible protocols.

This enhancement will allow someone to either:

  1. Help display to a user a stringified status
  2. Display to a developer a stringified debug status in the debug console

This will allow a developer to more easily convey information contained in an Objective-C enum (statuses, etc) to themselves or to the user.

For example:

extension AGSDrawStatus: CustomStringConvertible {
    
    public var description: String {
        switch self {
        case AGSDrawStatusInProgress:
            return "In Progress"
        case AGSDrawStatusCompleted:
            return "Completed"
        default:
            return ""
        }
    }
}

extension AGSDrawStatus: CustomDebugStringConvertible {
    
    public var debugDescription: String {
        return "[Draw Status] \(self)"
    }
}

let drawStatus:AGSDrawStatus = AGSDrawStatusInProgress

print(drawStatus)
// In Progress

print(drawStatus.description)
// In Progress

print(drawStatus.debugDescription)
// [Draw Status] In Progress

and

(lldb) po drawStatus
โ–ฟ [Draw Status] In Progress
  - rawValue : 0

Possible to use with static framework of ArcGIS Runtime SDK for iOS?

My project uses static ArcGIS.framework.
Drag and Drop the ArcGISToolkit.xcodeproj file into my project.
An running error occurred.

dyld: Library not loaded: @rpath/ArcGIS.framework/ArcGIS
Referenced from: /Users/apps/Library/Developer/Xcode/DerivedData/ArcGISToolkitExamples-ghoiwslxqdkgkqcguihehpstocng/Build/Products/Debug-iphonesimulator/ArcGISToolkit.framework/ArcGISToolkit
Reason: image not found

Fix deprecated method warning in `ArcGISARView.swift` (iOS 14)

With the update to require iOS 14, there is a new deprecation warning. This needs to be addressed.

Showing All Messages /Sources/ArcGISToolkit/AR/ArcGISARView.swift:334:33: 'hitTest(_:types:)' was deprecated in iOS 14.0: Use [ARSCNView raycastQueryFromPoint:allowingTarget:alignment]

Update pod name in README

When the coco pod name is referenced in the README it says the pod name is: pod ArcGIS-Runtime-Toolkit-iOS but it should be corrected to pod 'ArcGIS-Runtime-Toolkit-iOS'
The corrected pod name is the one you can directly copy and paste into your podfile, the current pod name in the README if you copy and paste would give you an error.

Crash when adding attachment using PopupController

Using the same code from this issue .
Steps to reproduce crash:

  1. Create small sample app using code from the issue linked above.
  2. Click on a feature on the map view.
  3. Click on the Attached tab
  4. Click on Edit (the right bar button item on nav bar)
  5. Click on Add Attachment

The app will crash and this is the console says this:
logPic

Crash in AR Example

In the AR Example, using the latest 100.15 daily, pressing "Calibration" or "Change Scene" triggers unrecognized selector crashes.

The selectors appear to be valid.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[ArcGISToolkitExamples.ARExample changeScene:]: unrecognized selector sent to class 0x100419918'

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[ArcGISToolkitExamples.ARExample displayCalibration:]: unrecognized selector sent to class 0x1021cd918'

Audit upcoming release

  • Compass
  • Measure
  • Scalebar
  • Legend
  • Job Manager
  • Time Slider
  • Popup Controller
  • Template Picker
  • AR (1 issue found #178 with resolution in PR #180)
  • Bookmarks
  • Floor Filter
  • Doc updates #179
  • Run tests
  • Merge #179
  • Merge #181 to address #176

Legend - provide a way to hide basemap legend info with one property.

Currently, there is no easy way to exclude basemaps from displaying in the legend. The AGOL viewers do not seem to provide a way to set the showInLegend property for a basemap to false. Also, many basemaps do not contain useful legend information.

In order to hide basemaps in a legend, you have to loop through all "base" and "reference" layers in a basemap and manually set their showInLegend property to false:

        map?.load { [weak self] error in
            guard error == nil else { return }
            self?.map?.basemap.load { [weak self] error in
                guard error == nil,
                let basemap = self?.map?.basemap else { return }
                _ = basemap.referenceLayers.map { ($0 as? AGSLayerContent)?.showInLegend = false }
                _ = basemap.baseLayers.map { ($0 as? AGSLayerContent)?.showInLegend = false }
            }
        }

It would be very convenient to have a LegendViewController property to hide all basemap data in a legend, such as:

/// A Boolean value indicating whether to show the basemap layers in the legend.
public var showBasemapInLegend: Bool = true

See #173

Row for previously selected sample remains selected

When a selected example is dismissed, the row for that example remains selected. This is different than the default behavior of UITableViewController, which deselects the currently selected row on viewWillAppear(_:).

Persistent Selection

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.