You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-17Lines changed: 18 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,12 +9,10 @@ ClusterMap is an open-source library for high-performance map clustering.
9
9
When you want to present many points over the map for better user experience and performance, you can make clusters from many points. A good starting point is using a native clustering mechanism. It's simple to implement, simple to use, and has nice animations with zero lines of code. The core problem of the native implementation is adding all points to the map in MainThread. You can't avoid this bottleneck, and it's a problem if you want to operate with thousand points.
10
10
ClusterMap uses efficient QuadTree storage and performs all computations in the background thread.
11
11
12
-
Comparison with 20,000 annotations. For a detailed comprasion use [Example](Example).
12
+
Comparison with 20,000 annotations. For a detailed comparison, use [Example-UIKit](Example).
ClusterMap is available through CocoaPods. To install it, simply add the following line to your Podfile:
61
+
ClusterMap is available through CocoaPods. To install it, add the following line to your Podfile:
62
62
63
63
```ruby
64
-
pod 'ClusterMap', '1.0.0'
64
+
pod 'ClusterMap', '1.1.0'
65
65
```
66
66
67
67
68
68
## Usage
69
69
70
70
### The Basics
71
-
The `ClusterManager` class generates, manages and displays annotation clusters.
71
+
The `ClusterManager` class generates, manages, and displays annotation clusters.
72
72
73
73
```swift
74
74
let clusterManager =ClusterManager()
@@ -86,7 +86,7 @@ manager.add(annotation)
86
86
87
87
### Configuring the Annotation View
88
88
89
-
Implement the map view’s `mapView(_:viewFor:)` delegate method to configure the annotation view. Return an instance of `MKAnnotationView` to display as a visual representation of the annotations.
89
+
Implement the map view's `mapView(_:viewFor:)` delegate method to configure the annotation view. Return an instance of `MKAnnotationView` to visually represent the annotations.
90
90
91
91
To display clusters, return an instance of `ClusterAnnotationView`.
92
92
@@ -106,7 +106,7 @@ For performance reasons, you should generally reuse `MKAnnotationView` objects i
106
106
107
107
#### Customizing the Appearance
108
108
109
-
The `ClusterAnnotationView` class exposes a `countLabel` property. You can subclass `ClusterAnnotationView` to provide custom behavior as needed. Here's an example of subclassing the `ClusterAnnotationView` and customizing the layer `borderColor`.
109
+
The `ClusterAnnotationView` class exposes a `countLabel` property. You can subclass `ClusterAnnotationView` to provide custom behavior as needed. Here's an example of subclassing the `ClusterAnnotationView` and customizing the layer `borderColor`.
@@ -122,17 +122,17 @@ See the [AnnotationView](Example/Shared/Views/CountClusterAnnotationView.swift)
122
122
123
123
### Removing Annotations
124
124
125
-
To remove annotations, you can call `remove(annotation:)`. However the annotations will still display until you call `reload()`.
125
+
To remove annotations, you can call `remove(annotation:)`. However, the annotations will still display until you call `reload()`.
126
126
127
127
```swift
128
128
manager.remove(annotation)
129
129
```
130
130
131
-
In the case that `shouldRemoveInvisibleAnnotations` is set to `false`, annotations that have been removed may still appear on map until calling `reload()` on visible region.
131
+
If `shouldRemoveInvisibleAnnotations` is set to `false`, annotations that have been removed may still appear on the map until calling `reload()` on the visible region.
132
132
133
133
### Reloading Annotations
134
134
135
-
Implement the map view’s `mapView(_:regionDidChangeAnimated:)` delegate method to reload the `ClusterManager` when the region changes.
135
+
Implement the map view's `mapView(_:regionDidChangeAnimated:)` delegate method to reload the `ClusterManager` when the region changes.
@@ -155,12 +155,12 @@ var minCountForClustering: Int // The minimum number of annotations for a cluste
155
155
var shouldRemoveInvisibleAnnotations: Bool// Whether to remove invisible annotations. The default is `true`.
156
156
var shouldDistributeAnnotationsOnSameCoordinate: Bool// Whether to arrange annotations in a circle if they have the same coordinate. The default is `true`.
157
157
var distanceFromContestedLocation: Double// The distance in meters from contested location when the annotations have the same coordinate. The default is `3`.
158
-
var clusterPosition: ClusterPosition// The position of the cluster annotation. The default is `.nearCenter`.
158
+
var clusterPosition: ClusterAlignment// The position of the cluster annotation. The default is `.nearCenter`.
159
159
```
160
160
161
161
### ClusterManagerDelegate
162
162
163
-
The `ClusterManagerDelegate` protocol provides a number of functions to manage clustering and configure cells.
163
+
The `ClusterManagerDelegate` protocol provides many functions to manage clustering and configure cells.
164
164
165
165
```swift
166
166
// The size of each cell on the grid at a given zoom level.
0 commit comments