@@ -61,8 +61,8 @@ class ViewController: UIViewController {
6161 }
6262 }
6363
64- /// Holds reference for receiving update to the map's bounds .
65- private var mapBoundsUpdater : AnyCancellable ?
64+ /// Holds reference for receiving update to the map's current version .
65+ private var mapVersionUpdater : AnyCancellable ?
6666
6767 /// Loads the map object and assigns it to the map view.
6868 @IBAction private func loadMap( ) {
@@ -74,8 +74,8 @@ class ViewController: UIViewController {
7474 // Even with the asynchronous version, this function will return immediately if the map doesn't need to be downloaded.
7575 map = try await Map . managed ( id: mapID)
7676
77- /// Receives updates to the map's bounds , so that the zoom to user location button can be updated if the bounds changes.
78- mapBoundsUpdater = map. $bounds . receive ( on: RunLoop . main) . sink ( receiveValue: { [ weak self] _ in self ? . updateLocationButtonAvailability ( ) } )
77+ /// Receives updates to the map's version , so that the zoom to user location button can be updated if the bounds changes.
78+ mapVersionUpdater = map. $currentVersion . receive ( on: RunLoop . main) . sink ( receiveValue: { [ weak self] _ in self ? . updateLocationButtonAvailability ( ) } )
7979
8080 // Assign the map to the map view.
8181 mapView. map = map
@@ -184,7 +184,7 @@ class ViewController: UIViewController {
184184 break setPath
185185 }
186186
187- let route = map. pathNetwork!. calculateDirections ( from: Coordinates ( originLocation) , to: [ destinationLocation ] )
187+ let route = map. currentVersion . pathNetwork!. calculateDirections ( from: Coordinates ( originLocation) , to: [ destinationLocation ] )
188188
189189 guard let route else {
190190 print ( " A route to the destination was not found. " )
@@ -217,7 +217,7 @@ class ViewController: UIViewController {
217217 break checkAvailability
218218 }
219219
220- guard let map, map. bounds. contains ( Coordinates ( location) . mapPoint ( using: . webMercator) ) else {
220+ guard let map, map. currentVersion . bounds. contains ( Coordinates ( location) . mapPoint ( using: . webMercator) ) else {
221221 shouldEnable = false
222222 break checkAvailability
223223 }
0 commit comments