Skip to content

Commit 971e5c4

Browse files
committed
Optionalize redo search on map pan (#10)
1 parent bf511e1 commit 971e5c4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Pod/Classes/MapViewController.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ open class MapViewController: UIViewController {
5151
open var pinColor: UIColor?
5252
open var searchDebounceDuration: TimeInterval = 0.6
5353
open var selectedMapItem: MKMapItem?
54+
open var shouldRedoSearchOnPan = true
5455
open var userLocationDebounceDuration: TimeInterval = 0.6
5556
open var zoomedInSpan: CLLocationDegrees = 0.01
5657

@@ -557,7 +558,7 @@ extension MapViewController: MKMapViewDelegate {
557558
open func mapView(_ mapView: MKMapView, regionDidChangeAnimated animated: Bool) {
558559
if isDeferringSelection {
559560
performDeferredSelection(animated: animated)
560-
} else {
561+
} else if shouldRedoSearchOnPan {
561562
guard !hasSelectedPin && !isQuerying else { return }
562563
guard hasSearch && (wasMapPanned && !animated) else { return }
563564
NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(redoSearch), object: nil)

0 commit comments

Comments
 (0)