Latest 1.0
Homepage https://github.com/serejahh/MKMapView-Reusable
License MIT
Platforms ios 8.0, osx 10.9, tvos 9.2, requires ARC
Frameworks MapKit
Authors

Reuse MKAnnotationView as easy as UITableViewCell/UICollectionViewCell.

Usage

Vanilla

func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
    let annotationView: PassAnnotationView
    if let view = dequeueReusableAnnotationViewWithIdentifier(annotationViewType.reuseIdentifier) as? T {
        annotationView = view
    } else {
        return PassAnnotationView(annotation: annotation, reuseIdentifier: "annotation")
    }

    // configure the annotaion view 

    return annotationView
}

With Reusable

func mapView(mapView: MKMapView, viewForAnnotation annotation: MKAnnotation) -> MKAnnotationView? {
    let annotationView = mapView.dequeueReusableAnnotationView(annotation) as PassAnnotationView

    // configure the annotaion view 

    return annotationView
}

Installation

Cocoapods

pod 'MKMapView-Reusable', '~> 1.0'

Carthage

github `serejahh/MKMapView-Reusable` ~> 1.0

Latest podspec

{
    "name": "MKMapView+Reusable",
    "version": "1.0",
    "summary": "Reuse MKAnnotationView as easy as UITableViewCell/UICollectionViewCell.",
    "homepage": "https://github.com/serejahh/MKMapView-Reusable",
    "license": "MIT",
    "authors": {
        "Serhii Butenko": "[email protected]"
    },
    "source": {
        "git": "https://github.com/serejahh/MKMapView-Reusable.git",
        "tag": "1.0"
    },
    "social_media_url": "https://twitter.com/serejahh",
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "tvos": "9.2"
    },
    "requires_arc": true,
    "source_files": "MKMapView+Reusable/*.swift",
    "frameworks": "MapKit"
}

Pin It on Pinterest

Share This