Upgrade to Pro — share decks privately, control downloads, hide ads and more …

iOS 11 MapKit Annotation Clustering

denkeni
April 12, 2018

iOS 11 MapKit Annotation Clustering

denkeni

April 12, 2018
Tweet

More Decks by denkeni

Other Decks in Technology

Transcript

  1. With Clustering1 Looks cleaner2. 2 App Store: CafeFreelance - ૡ֢߅珹記

    1 https://github.com/Nandalu/NDLAnnotationClustering
  2. clusteringIdentifier3 An identifier that determines whether the annotation view participates

    in clustering. var clusteringIdentifier: String? { get set } The default value of this property is nil, which prevents the annotation view from being clustered with other annotation views. Setting the property to a non nil value it to participate in clustering. 3 Documentation > MapKit > MKAnnotationView > clusteringIdentifier
  3. final class AnnotaionView : MKMarkerAnnotationView { override init(annotation: MKAnnotation?, reuseIdentifier:

    String?) { super.init(annotation: annotation, reuseIdentifier: reuseIdentifier) clusteringIdentifier = "AnnotaionView" } } DID NOT WORK (But seems to work now, at latest version)
  4. Working code4 final class AnnotaionView : MKMarkerAnnotationView { override var

    annotation: MKAnnotation? { willSet { clusteringIdentifier = "AnnotaionView" } } } 4 What's New in MapKit, WWDC 2017 - Session 237
  5. Summary: — Use MapKit Annotation Clustering on iOS 11.3 or

    later — Question, or help5? 5 https://github.com/Nandalu/Housing