diff --git a/Sources/MapLibreSwiftUI/MapView.swift b/Sources/MapLibreSwiftUI/MapView.swift index 3e51f55..8987b4d 100644 --- a/Sources/MapLibreSwiftUI/MapView.swift +++ b/Sources/MapLibreSwiftUI/MapView.swift @@ -3,7 +3,7 @@ import MapLibre import MapLibreSwiftDSL import SwiftUI -public struct MapView: UIViewControllerRepresentable { +public struct MapView: UIViewControllerRepresentable { public typealias UIViewControllerType = T var cameraDisabled: Bool = true diff --git a/Sources/MapLibreSwiftUI/MapViewController.swift b/Sources/MapLibreSwiftUI/MapViewController.swift index c07ae72..ff443b1 100644 --- a/Sources/MapLibreSwiftUI/MapViewController.swift +++ b/Sources/MapLibreSwiftUI/MapViewController.swift @@ -1,12 +1,12 @@ import MapLibre import UIKit -public protocol WrappedViewController: UIViewController { +public protocol MapViewHostViewController: UIViewController { associatedtype MapType: MLNMapView var mapView: MapType { get } } -public final class MapViewController: UIViewController, WrappedViewController { +public final class MapViewController: UIViewController, MapViewHostViewController { public var mapView: MLNMapView { view as! MLNMapView } diff --git a/Sources/MapLibreSwiftUI/MapViewCoordinator.swift b/Sources/MapLibreSwiftUI/MapViewCoordinator.swift index 6c6d64b..52051df 100644 --- a/Sources/MapLibreSwiftUI/MapViewCoordinator.swift +++ b/Sources/MapLibreSwiftUI/MapViewCoordinator.swift @@ -2,7 +2,7 @@ import Foundation import MapLibre import MapLibreSwiftDSL -public class MapViewCoordinator: NSObject, MLNMapViewDelegate { +public class MapViewCoordinator: NSObject, MLNMapViewDelegate { // This must be weak, the UIViewRepresentable owns the MLNMapView. weak var mapView: MLNMapView? var parent: MapView diff --git a/Sources/MapLibreSwiftUI/MapViewModifiers.swift b/Sources/MapLibreSwiftUI/MapViewModifiers.swift index c0a1a23..07f91a4 100644 --- a/Sources/MapLibreSwiftUI/MapViewModifiers.swift +++ b/Sources/MapLibreSwiftUI/MapViewModifiers.swift @@ -135,7 +135,10 @@ public extension MapView { result.onViewPortChanged = onViewPortChanged return result } - + + /// Prevent Maplibre-DSL from updating the camera, useful when the underlying ViewController is managing the camera, for example during navigation when Maplibre-Navigation is used. + /// - Parameter disabled: if true, prevents Maplibre-DSL from updating the camera + /// - Returns: The modified MapView func cameraModifierDisabled(_ disabled: Bool) -> Self { var view = self view.cameraDisabled = disabled