interactionOptions does not work...

Discussion created by worthsparks on Dec 15, 2017
Latest reply on Sep 13, 2018 by worthsparks

...if another gesture is already in progress. Or at least that is how the problem appears to me. My app is Draw GIS (similar to Draw Maps in the App Store). It allows the user to freehand draw in the web map. To do so in my code, I add a gesture recognizer to capture drawing strokes. When a stroke begins, I have to disable mapView.interactionOptions. This used to work in earlier versions but somewhere along the way this stopped working. To get around the problem, I disable/enable the mapView's pan, pinch, and rotate gesture recognizers directly.


class MapView: AGSMapView {
    func interaction(isEnabled: Bool) {
        self.interactionOptions.isEnabled = isEnabled
        guard let gestureRecognizers = gestureRecognizers else { return }
        for gestureRecognizer in gestureRecognizers {
            if let panGestureRecognizer = gestureRecognizer as? UIPanGestureRecognizer {
                panGestureRecognizer.isEnabled = isEnabled
            } else if let pinchGestureRecognizer = gestureRecognizer as? UIPinchGestureRecognizer {
                pinchGestureRecognizer.isEnabled = isEnabled
            } else if let rotationGestureRecognizer = gestureRecognizer as? UIRotationGestureRecognizer {
                rotationGestureRecognizer.isEnabled = isEnabled


I hope this helps someone.