Skip to content

Commit

Permalink
Feat: remove all markers when user request to search
Browse files Browse the repository at this point in the history
Remove markers remaining and redraw them when user requests to search again
  • Loading branch information
jinios committed Sep 1, 2019
1 parent 91c1c30 commit c751052
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class LocationSearchViewController: IndicatorViewController, NMFMapViewDelegate,
}
}

var markers = [NMFMarker]()
let nMapViewObserverKeypath = "positionMode"

override func viewDidLoad() {
Expand Down Expand Up @@ -252,6 +253,7 @@ extension LocationSearchViewController {
let cameraUpdate = NMFCameraUpdate(zoomTo: self.zoomLevel())
cameraUpdate.animation = .easeOut
naverMapView.mapView.moveCamera(cameraUpdate)
self.markers.forEach { $0.mapView = nil }

branches.branches.forEach({ (mart) in
let marker = self.makeMarkers(of: mart)
Expand All @@ -277,6 +279,7 @@ extension LocationSearchViewController {
return false // didTapMapView
}
marker.mapView = self.naverMapView.mapView
self.markers.append(marker)
})
}

Expand Down

0 comments on commit c751052

Please sign in to comment.