Skip to content

MapKitGoogleStyler no longer working #10

@ajaymerchia

Description

@ajaymerchia

Can anyone confirm that this library is no longer functioning -- perhaps Apple restricted usage of tileOverlays for this purpose.

I call the following in viewDidLoad

//  LayoutManager is a custom library that I wrote, it successfully places the MapView onscreen
        mapView = MKMapView(frame: LayoutManager.between(elementAbove: roundName, elementBelow: selectTeamButton, width: view.frame.width, topPadding: 2 * .MARGINAL_PADDING, bottomPadding: .PADDING))
        mapView.delegate = self
        mapView.showsUserLocation = true
        mapView.setUserTrackingMode(.follow, animated: true)
        view.addSubview(mapView)
        restyleMap()

Where restyleMap contains

guard let overlayFileURLString = Bundle.main.path(forResource: "overlay", ofType: "json") else {
            return
        }
        let overlayFileURL = URL(fileURLWithPath: overlayFileURLString)
        debugPrint(overlayFileURL)
        // After that, you can create the tile overlay using MapKitGoogleStyler
        guard let tileOverlay = try? MapKitGoogleStyler.buildOverlay(with: overlayFileURL) else {
            return
        }
        // And finally add it to your MKMapView
        mapView.delegate = self
        mapView.addOverlay(tileOverlay, level: .aboveLabels)
        debugPrint(mapView.overlays)

I can confirm that the overlay is added to the map, but the dark style JSON doesn't load. I put a breakpoint inside the func mapView(_ mapView: MKMapView, rendererFor overlay: MKOverlay) -> MKOverlayRenderer function, but the function isn't getting called.

Any thoughts on why this might be happening? Is the renderer returned without the necessary attributes to make the map load it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions