Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use clusterManager in MGLMapView extensions (Carthage & 0.4.0) #67

Closed
Max37550 opened this issue Mar 9, 2019 · 2 comments
Closed

Use clusterManager in MGLMapView extensions (Carthage & 0.4.0) #67

Max37550 opened this issue Mar 9, 2019 · 2 comments

Comments

@Max37550
Copy link

Max37550 commented Mar 9, 2019

Hello,

This issue only happens when using Carthage, it works fine with Cocoapods.

The following snippet doesn't compile with the version 0.4.0, but it did work before. It says it cannot found clusterManager. I have noticed a difference in the framework built by Carthage, MKMapView+ClusterKit.h is in PrivateHeaders but for 0.3.5, it is in Headers.

import ClusterKit
import Mapbox

protocol Foo {
         var selectedAnnotation: MKAnnotation { get }
}

extension MGLMapView: Foo {
	var selectedAnnotation: MKAnnotation {
		return clusterManager.selectedAnnotation
	}
}

Thanks for your help. :)

@rabc
Copy link

rabc commented Apr 9, 2019

There is any specific reason for MKMapView+ClusterKit.h to be in Private headers?

@maxep
Copy link
Contributor

maxep commented Apr 9, 2019

Hey!

@Max37550

For Cluster+MapKit with Carthage, you should import the submodule:

import ClusterKit.MapKit

cf. https://github.com/hulab/ClusterKit/wiki/MapKit

Cluster+Mapbox

The MGLMapView+ClusterKit extension is not part of the ClusterKit.framework to respect the interface segregation principle.
If you want to use ClusterKit with Mapbox using Carthage I suggest to copy/past the MGLMapView+ClusterKit.{h,m} files to your project. I know this not ideal but I don't want to force the MapBox dependency.

@rabc

MKMapView+ClusterKit.h is private for the same reason, the difference is that MapKit is always available in iOS. To use it, you need to explicitly import it:

Objective-C:
#import <ClusterKit/MKMapView+ClusterKit.h>
Swift:
import ClusterKit.MapKit

@maxep maxep closed this as completed Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants