Use `clusterManager` in MGLMapView extensions (Carthage & 0.4.0)
Max37550 opened this issue · 2 comments
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. :)
There is any specific reason for MKMapView+ClusterKit.h
to be in Private headers?
Hey!
@Max37550
For Cluster+MapKit
with Carthage, you should import the submodule:
import ClusterKit.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