Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick-Kladek committed Jul 15, 2024
1 parent 5ed30bd commit 5ab5390
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Sources/MapLibreSwiftUI/MapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import MapLibre
import MapLibreSwiftDSL
import SwiftUI

public struct MapView<T: WrappedViewController>: UIViewControllerRepresentable {
public struct MapView<T: MapViewHostViewController>: UIViewControllerRepresentable {
public typealias UIViewControllerType = T
var cameraDisabled: Bool = true

Expand Down
4 changes: 2 additions & 2 deletions Sources/MapLibreSwiftUI/MapViewController.swift
Original file line number Diff line number Diff line change
@@ -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 {

Check warning on line 10 in Sources/MapLibreSwiftUI/MapViewController.swift

View workflow job for this annotation

GitHub Actions / test (MapLibreSwiftUI-Package, platform=iOS Simulator,name=iPhone 15,OS=17.2)

main actor-isolated property 'mapView' cannot be used to satisfy nonisolated protocol requirement

Check warning on line 10 in Sources/MapLibreSwiftUI/MapViewController.swift

View workflow job for this annotation

GitHub Actions / test (MapLibreSwiftUI-Package, platform=iOS Simulator,name=iPhone 15,OS=17.2)

main actor-isolated property 'mapView' cannot be used to satisfy nonisolated protocol requirement
view as! MLNMapView
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/MapLibreSwiftUI/MapViewCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Foundation
import MapLibre
import MapLibreSwiftDSL

public class MapViewCoordinator<T: WrappedViewController>: NSObject, MLNMapViewDelegate {
public class MapViewCoordinator<T: MapViewHostViewController>: NSObject, MLNMapViewDelegate {
// This must be weak, the UIViewRepresentable owns the MLNMapView.
weak var mapView: MLNMapView?
var parent: MapView<T>
Expand Down
5 changes: 4 additions & 1 deletion Sources/MapLibreSwiftUI/MapViewModifiers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5ab5390

Please sign in to comment.