Latest 1.0.4
Homepage https://github.com/vadymmarkov/PinFloyd
License MIT
Platforms ios 9.0, tvos 9.2, requires ARC
Frameworks UIKit, MapKit
Authors

CI Status
Version
Carthage Compatible
License
Platform
Swift

Description

MapKit annotations clustering for iOS.

Usage

Create an instance of ClusteringManager:

let clusteringManager = ClusteringManager()

Add annotations:

clusteringManager.add(annotations: annotations)

Replace annotations:

clusteringManager.replace(annotations: annotations)

Render annotations on region change:

// MKMapViewDelegate
func mapView(_ mapView: MKMapView, regionDidChangeAnimated animated: Bool) {
  clusteringManager.renderAnnotations(onMapView: mapView)
}

Reuse annotation view:

func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
  switch annotation {
  case let annotation as ClusterAnnotation:
    let id = ClusterAnnotationView.identifier

    var clusterView = mapView.dequeueReusableAnnotationView(withIdentifier: id)
    if clusterView == nil {
      clusterView = ClusterAnnotationView(annotation: annotation, reuseIdentifier: id)
    } else {
      clusterView?.annotation = annotation
    }

    return clusterView
  default:
    // return annotation view
}

Installation

PinFloyd is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'PinFloyd'

PinFloyd is also available through Carthage.
To install just write into your Cartfile:

github "vadymmarkov/PinFloyd"

PinFloyd can also be installed manually. Just download and drop Sources folders in your project.

Author

Vadym Markov, [email protected]

Credits

This library was originally done at Hyper, a digital
communications agency with a passion for good code and delightful user experiences.

Contributing

Check the CONTRIBUTING file for more info.

License

PinFloyd is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "PinFloyd",
    "summary": "MapKit annotations clustering for iOS.",
    "version": "1.0.4",
    "homepage": "https://github.com/vadymmarkov/PinFloyd",
    "license": "MIT",
    "authors": {
        "Vadym Markov": "[email protected]"
    },
    "source": {
        "git": "https://github.com/vadymmarkov/PinFloyd.git",
        "tag": "1.0.4"
    },
    "social_media_url": "https://twitter.com/vadymmarkov",
    "platforms": {
        "ios": "9.0",
        "tvos": "9.2"
    },
    "requires_arc": true,
    "source_files": "Sources/**/*",
    "frameworks": [
        "UIKit",
        "MapKit"
    ],
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "4.0"
    }
}

Pin It on Pinterest

Share This