File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -84,13 +84,6 @@ public struct MapView: UIViewRepresentable {
8484 public func updateUIView( _ mapView: MLNMapView , context: Context ) {
8585 context. coordinator. parent = self
8686
87- switch styleSource {
88- case let . url( styleURL) :
89- if styleURL != mapView. styleURL {
90- mapView. styleURL = styleURL
91- }
92- }
93-
9487 applyModifiers ( mapView, runUnsafe: true )
9588
9689 // FIXME: This should be a more selective update
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ public class MapViewCoordinator: NSObject {
1111 // every update cycle so we can avoid unnecessary updates
1212 private var snapshotUserLayers : [ StyleLayerDefinition ] = [ ]
1313 private var snapshotCamera : MapViewCamera ?
14+ private var snapshotStyleSource : MapStyleSource ?
1415
1516 // Indicates whether we are currently in a push-down camera update cycle.
1617 // This is necessary in order to ensure we don't keep trying to reset a state value which we were already processing
@@ -102,12 +103,16 @@ public class MapViewCoordinator: NSObject {
102103 // MARK: - Coordinator API - Styles + Layers
103104
104105 @MainActor func updateStyleSource( _ source: MapStyleSource , mapView: MLNMapView ) {
105- switch ( source, parent . styleSource ) {
106+ switch ( source, snapshotStyleSource ) {
106107 case let ( . url( newURL) , . url( oldURL) ) :
107108 if newURL != oldURL {
108109 mapView. styleURL = newURL
109110 }
111+ case let ( . url( newURL) , . none) :
112+ mapView. styleURL = newURL
110113 }
114+
115+ snapshotStyleSource = source
111116 }
112117
113118 @MainActor func updateLayers( mapView: MLNMapView ) {
You can’t perform that action at this time.
0 commit comments