iOS 11 MapKit Annotation Clustering

188a42adbd815a746df557c7dc72566a?s=47 denkeni
April 12, 2018

iOS 11 MapKit Annotation Clustering

188a42adbd815a746df557c7dc72566a?s=128

denkeni

April 12, 2018
Tweet

Transcript

  1. 2.
  2. 3.

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

    1 https://github.com/Nandalu/NDLAnnotationClustering
  3. 6.

    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
  4. 7.
  5. 8.

    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)
  6. 9.

    Working code4 final class AnnotaionView : MKMarkerAnnotationView { override var

    annotation: MKAnnotation? { willSet { clusteringIdentifier = "AnnotaionView" } } } 4 What's New in MapKit, WWDC 2017 - Session 237
  7. 11.
  8. 13.
  9. 14.

    Summary: — Use MapKit Annotation Clustering on iOS 11.3 or

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