Skip to content

Commit

Permalink
captures self weakly
Browse files Browse the repository at this point in the history
  • Loading branch information
esreli committed Oct 21, 2019
1 parent 504ca08 commit af1b13b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ extension MapViewController {
}
}

mapView.locationDisplay.autoPanModeChangedHandler = { newAutoPanMode in
mapView.locationDisplay.autoPanModeChangedHandler = { [weak self] newAutoPanMode in
guard let self = self else { return }

This comment has been minimized.

Copy link
@philium

philium Oct 21, 2019

This guard should be inside the closure that is executed on the main queue.

print("New autoPanMode: \(newAutoPanMode)")
DispatchQueue.main.async {
self.gpsButton.setImage(self.mapView.locationDisplay.getImage(), for: .normal)
Expand Down

0 comments on commit af1b13b

Please sign in to comment.