Skip to content

Commit

Permalink
Update swiftformat
Browse files Browse the repository at this point in the history
  • Loading branch information
vospennikov committed Sep 9, 2023
1 parent 0ce2df3 commit bb264b8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Sources/ClusterMap/Public/Core/ClusterManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public final class ClusterManager<Annotation: CoordinateIdentifiable>
}
}
}

/// Reloads the annotations on the map based on the current zoom level and visible map region.
/// This is an async-await variant of the `reload(mapViewSize:coordinateRegion:completion:)` method.
///
Expand All @@ -169,7 +169,7 @@ public final class ClusterManager<Annotation: CoordinateIdentifiable>
}
}
}

/// Reloads the annotations on the map based on the current zoom level and visible map region.
///
/// - Parameters:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import MapKit

/// Manages the alignment of clustered annotations on the map.
///
/// `ClusterAlignment` is a wrapper around a `ClusterAlignmentStrategy` implementation. It is responsible for determining the position of the cluster icon based on the geographical coordinates of its constituent annotations.
/// `ClusterAlignment` is a wrapper around a `ClusterAlignmentStrategy` implementation. It is responsible for
/// determining the position of the cluster icon based on the geographical coordinates of its constituent annotations.
///
/// - Note: You can initialize `ClusterAlignment` with any object conforming to `ClusterAlignmentStrategy`.
/// This allows for custom alignment strategies.
Expand All @@ -32,15 +33,17 @@ public struct ClusterAlignment: ClusterAlignmentStrategy {

/// Initializes a new `ClusterAlignment` instance.
///
/// - Parameter alignmentStrategy: The object implementing `ClusterAlignmentStrategy` to be used for cluster alignment.
/// - Parameter alignmentStrategy: The object implementing `ClusterAlignmentStrategy` to be used for cluster
/// alignment.
public init(alignmentStrategy: ClusterAlignmentStrategy) {
self.alignmentStrategy = alignmentStrategy
}

/// Calculates the position for a cluster based on its coordinates.
///
/// - Parameters:
/// - coordinates: An array of `CLLocationCoordinate2D` representing the geographical coordinates of each annotation in the cluster.
/// - coordinates: An array of `CLLocationCoordinate2D` representing the geographical coordinates of each
/// annotation in the cluster.
/// - mapRect: The visible rectangle area of the map view.
///
/// - Returns: The `CLLocationCoordinate2D` that represents the cluster's aligned position on the map.
Expand All @@ -58,7 +61,8 @@ public extension ClusterAlignment {
alignmentStrategy: GetCenterCoordinate()
)

/// Сluster position near to the center of the map grid relative to the underlying annotations. If there are no annotations, it falls back to the center of map grid.
/// Сluster position near to the center of the map grid relative to the underlying annotations. If there are no
/// annotations, it falls back to the center of map grid.
static let nearCenter = ClusterAlignment(
alignmentStrategy: GetNearCenterCoordinate(clusterCenterPosition: GetCenterCoordinate())
)
Expand All @@ -68,7 +72,8 @@ public extension ClusterAlignment {
alignmentStrategy: GetAverageCoordinate()
)

/// Cluster position is equal to the location of the first of the underlying annotations. If there are no annotations, it falls back to the center of map grid.
/// Cluster position is equal to the location of the first of the underlying annotations. If there are no
/// annotations, it falls back to the center of map grid.
static let first = ClusterAlignment(
alignmentStrategy: GetFirstCoordinate(fallback: GetCenterCoordinate())
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,43 @@ public extension ClusterManager {
///
/// Beyond this zoom level, annotations will be displayed individually.
///
/// - Note: The minimum value is `0` (max zoom out) and the maximum value is `20` (max zoom in). The default is `20`.
/// - Note: The minimum value is `0` (max zoom out) and the maximum value is `20` (max zoom in). The default is
/// `20`.
@Clamping(to: 0...20)
public var maxZoomLevel: Double = 20

/// Threshold number for clustering within a region.
///
/// This count is the minimum number of annotations required to form a cluster. Annotations in regions with fewer than this count will not be clustered.
/// This count is the minimum number of annotations required to form a cluster. Annotations in regions with
/// fewer than this count will not be clustered.
///
/// - Note: The default is `2`.
@Clamping(to: 0...)
public var minCountForClustering: Int = 2

/// Removal of non-visible annotations.
///
/// This optimizes rendering performance by avoiding the computation of annotations that aren't currently visible in the map's viewport.
/// This optimizes rendering performance by avoiding the computation of annotations that aren't currently
/// visible in the map's viewport.
/// When set to `true`, annotations outside the current map view will not be processed.
///
/// - Note: The default is `true`.
public var shouldRemoveInvisibleAnnotations: Bool

/// Distribution of annotations with identical coordinates.
///
/// This ensures that annotations with identical or very close coordinates can still be distinctly recognized and interacted with by the user.
/// When set to `true`, annotations with the same coordinate will be distributed slightly to prevent them from overlapping.
/// This ensures that annotations with identical or very close coordinates can still be distinctly recognized
/// and interacted with by the user.
/// When set to `true`, annotations with the same coordinate will be distributed slightly to prevent them from
/// overlapping.
///
/// - Note: The default is `true`.
public var shouldDistributeAnnotationsOnSameCoordinate: Bool

/// Distance (in meters) for distributing overlapping annotations.
///
/// When `shouldDistributeAnnotationsOnSameCoordinate` is `true`, this value represents the distance (in meters) by which annotations should be shifted apart from a contested location.
/// When `shouldDistributeAnnotationsOnSameCoordinate` is `true`, this value represents the distance (in meters)
/// by which annotations should be shifted apart from a contested location.
///
/// - Note: The default is `3`.
@Clamping(to: 0...)
Expand All @@ -71,11 +77,14 @@ public extension ClusterManager {
/// The following clustering strategies are available for use:
///
/// - `.center`: Represents the center position for a cluster of `MKAnnotation` instances.
/// - `.nearCenter`: Represents the position of the `MKAnnotation` nearest to the center. Defaults to the center if no annotations are available.
/// - `.nearCenter`: Represents the position of the `MKAnnotation` nearest to the center. Defaults to the center
/// if no annotations are available.
/// - `.average`: Represents the average position for a cluster of `MKAnnotation` instances.
/// - `.first`: Represents the first `MKAnnotation` position within a cluster. Defaults to the center if no annotations are available.
/// - `.first`: Represents the first `MKAnnotation` position within a cluster. Defaults to the center if no
/// annotations are available.
///
/// - Note: You can develop your alignment strategy by implementing the `ClusterAlignmentStrategy` protocol on a `ClusterAlignment` struct.
/// - Note: You can develop your alignment strategy by implementing the `ClusterAlignmentStrategy` protocol on a
/// `ClusterAlignment` struct.
///
/// Here's an example:
/// ```swift
Expand All @@ -96,12 +105,15 @@ public extension ClusterManager {

/// Dynamic size adjustment of the grid cell for a given zoom level.
///
/// This closure takes an `Int` value representing the zoom level and returns a `CGSize` that sets the dimensions of the cell size at that zoom level.
/// This closure takes an `Int` value representing the zoom level and returns a `CGSize` that sets the
/// dimensions of the cell size at that zoom level.
///
/// Use this to control how cells should be sized at different zoom levels to optimize clustering and performance.
/// Use this to control how cells should be sized at different zoom levels to optimize clustering and
/// performance.
///
/// - Parameter zoom: The zoom level as an `Int`.
/// - Returns: A `CGSize` representing the width and height of the cell at the given zoom level. Only square cell is supported.
/// - Returns: A `CGSize` representing the width and height of the cell at the given zoom level. Only square
/// cell is supported.
///
/// - Note: Here's an example::
///
Expand Down

0 comments on commit bb264b8

Please sign in to comment.