diff --git a/TIAppleMapUtils/Sources/AppleClusterPlacemarkManager.swift b/TIAppleMapUtils/Sources/AppleClusterPlacemarkManager.swift index c13dd8b8..f672f83b 100644 --- a/TIAppleMapUtils/Sources/AppleClusterPlacemarkManager.swift +++ b/TIAppleMapUtils/Sources/AppleClusterPlacemarkManager.swift @@ -25,9 +25,8 @@ import MapKit import UIKit open class AppleClusterPlacemarkManager: BaseClusterPlacemarkManager], - MKMapRect, - CLLocationCoordinate2D>, + ApplePlacemarkManager, + MKMapRect>, MKMapViewDelegate { public weak var mapViewDelegate: MKMapViewDelegate? diff --git a/TIGoogleMapUtils/Sources/GoogleClusterPlacemarkManager.swift b/TIGoogleMapUtils/Sources/GoogleClusterPlacemarkManager.swift index 8a5e1a6a..c1c715cc 100644 --- a/TIGoogleMapUtils/Sources/GoogleClusterPlacemarkManager.swift +++ b/TIGoogleMapUtils/Sources/GoogleClusterPlacemarkManager.swift @@ -25,9 +25,8 @@ import GoogleMapsUtils import GoogleMaps open class GoogleClusterPlacemarkManager: BaseClusterPlacemarkManager], - GMSCoordinateBounds, - CLLocationCoordinate2D>, + GooglePlacemarkManager, + GMSCoordinateBounds>, GMUClusterRendererDelegate, GMUClusterManagerDelegate, GMUClusterIconGenerator { diff --git a/TIMapUtils/Sources/IconProviders/MarkerState.swift b/TIMapUtils/Sources/IconProviders/MarkerState.swift index c3d53f05..c21f9762 100644 --- a/TIMapUtils/Sources/IconProviders/MarkerState.swift +++ b/TIMapUtils/Sources/IconProviders/MarkerState.swift @@ -21,7 +21,7 @@ // /// Available marker states on any map -public enum MarkerState { +public enum MarkerState: String { /// A state where a map point is selected and a marker is highlighted case selected diff --git a/TIMapUtils/Sources/Managers/BaseClusterPlacemarkManager.swift b/TIMapUtils/Sources/Managers/BaseClusterPlacemarkManager.swift index 493a1980..44aa6b94 100644 --- a/TIMapUtils/Sources/Managers/BaseClusterPlacemarkManager.swift +++ b/TIMapUtils/Sources/Managers/BaseClusterPlacemarkManager.swift @@ -24,39 +24,20 @@ Base cluster placemark manager - Parameters: - - `Placemark`: a generic parameter describing a cluster placemark itself - - `ClusterDataModel`: an array of single placemarks managers for a cluster - - `ClusterPoints`: a collection of cluster placemark objects - - `Position`: a type of a single manager's placemark position + - `ClusterPlacemark`: a generic parameter describing a cluster placemark itself + - `ItemPlacemarkManager`: a single placemarks manager element of array for a cluster + - `ClusterBounds`: a collection of cluster placemark objects */ -open class BaseClusterPlacemarkManager: - BasePlacemarkManager { +open class BaseClusterPlacemarkManager: + BasePlacemarkManager where ItemPlacemarkManager.Position : Equatable { /// Manual selecting of a placemark with an incoming point coordinates - open func selectMarker(with point: Position) { - guard let dataModel = dataModel as? Array else { - return - } - - dataModel - .filter { - guard let placemarkPosition = $0.placemarkPosition as? Position else { - return false - } - - return placemarkPosition == point - } - .forEach { - $0.state = .selected - } + open func selectMarker(with point: ItemPlacemarkManager.Position) { + dataModel.filter { $0.placemarkPosition == point }.forEach { $0.state = .selected } } /// Manual state resetting of all placemarks with currently selected state open func resetMarkersState() { - guard let dataModel = dataModel as? Array else { - return - } - dataModel.filter { $0.state == .selected }.forEach { $0.state = .default } } } diff --git a/TIYandexMapUtils/Sources/YandexClusterPlacemarkManager.swift b/TIYandexMapUtils/Sources/YandexClusterPlacemarkManager.swift index 472f2502..84d6ede1 100644 --- a/TIYandexMapUtils/Sources/YandexClusterPlacemarkManager.swift +++ b/TIYandexMapUtils/Sources/YandexClusterPlacemarkManager.swift @@ -26,9 +26,8 @@ import UIKit import CoreLocation open class YandexClusterPlacemarkManager: BaseClusterPlacemarkManager], - [YMKPoint], - YMKPoint>, + YandexPlacemarkManager, + [YMKPoint]>, YMKClusterListener, YMKClusterTapListener {