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

Add Swift Package Manager Support #87

Merged
merged 2 commits into from
Jul 28, 2020
Merged

Conversation

maxep
Copy link
Contributor

@maxep maxep commented Jul 17, 2020

Issue Link πŸ”—

Fixes #77

Goals ⚽

Add support of Swift Package Manager.

Implementation Details 🚧

  • As ClusterKit is implemented in objc, the project needs to follow the C library structure:
    . 
    β”œβ”€β”€ Package.swift
    └── Sources 
         └── ClusterKit
           β”œβ”€β”€ **/*.m
           └── include 
             β”œβ”€β”€ ClusterKit 
             | └── *.h
             └── module.modulemap
  • In order to be built by swift build (macOS), UIKit availability has to be checked using compile fag:
#if __has_include(<UIKit/UIKit.h>)
...
#endif
  • Replace #import "*.h" with module import #import <ClusterKit/*.h>.

Testing Details πŸ”

Test suite is not yet available at swift test, tests will need to be re-rewritten in swift.

@maxep maxep force-pushed the feature/swift-package-manager branch from 477518c to afae8c4 Compare July 17, 2020 11:06
@carbonimax
Copy link
Contributor

It's all good but mapView.clusterManager seems to be not exposed to swift.

Error

@maxep
Copy link
Contributor Author

maxep commented Jul 28, 2020

@carbonimax It's using a custom module.modulemap for SPM. You need to import the submodule:

import ClusterKit.MapKit

@carbonimax
Copy link
Contributor

I missed it! It works

@carbonimax carbonimax merged commit a32d4e8 into master Jul 28, 2020
@thothai94
Copy link

How can I import this ClusterKit package to use with Mapbox?
"import ClusterKit.Mapbox" or "import ClusterKit" always cause error "Value of type 'MGLMapView' has no member 'clusterManager'"

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

Successfully merging this pull request may close these issues.

Swift Package Manager
3 participants