From eb514f3f8bbab56040d67f82732c0ccdd11ab2a0 Mon Sep 17 00:00:00 2001 From: Henry Ng Date: Wed, 18 Dec 2024 15:53:38 +0700 Subject: [PATCH 1/2] add function to get makers lists --- .../Types/W3WMarkersLists.swift | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Sources/W3WSwiftComponentsMap/Types/W3WMarkersLists.swift b/Sources/W3WSwiftComponentsMap/Types/W3WMarkersLists.swift index 7a8576d..5a3f526 100644 --- a/Sources/W3WSwiftComponentsMap/Types/W3WMarkersLists.swift +++ b/Sources/W3WSwiftComponentsMap/Types/W3WMarkersLists.swift @@ -90,5 +90,27 @@ public class W3WMarkersLists: CustomStringConvertible { return retval } + + /// Returns a dictionary of all marker lists indexed by their names. + /// + /// Use this method to access all marker lists stored in the W3WMarkersLists instance. + /// Each list contains markers and associated settings like color. + /// + /// - Returns: A dictionary where the key is the list name (String) and the value is the corresponding W3WMarkerList. + /// The dictionary includes the default list with key "default" if no other lists were added. + /// + /// - Example: + /// ``` + /// let markerLists = W3WMarkersLists() + /// let allLists = markerLists.getLists() + /// + /// // Access the default list + /// if let defaultList = allLists["default"] { + /// // Work with default list markers + /// } + /// ``` + public func getLists() -> [String: W3WMarkerList] { + return lists + } } From 062be58a900cdd4759b04c88c3d3ff40ed21e012 Mon Sep 17 00:00:00 2001 From: Henry Ng Date: Wed, 18 Dec 2024 16:23:10 +0700 Subject: [PATCH 2/2] add function to get markers list --- .../Types/W3WMarkerList.swift | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Sources/W3WSwiftComponentsMap/Types/W3WMarkerList.swift b/Sources/W3WSwiftComponentsMap/Types/W3WMarkerList.swift index 55ae8d4..4a26d22 100644 --- a/Sources/W3WSwiftComponentsMap/Types/W3WMarkerList.swift +++ b/Sources/W3WSwiftComponentsMap/Types/W3WMarkerList.swift @@ -40,6 +40,29 @@ public class W3WMarkerList: CustomStringConvertible { return retval.trimmingCharacters(in: .whitespaces).trimmingCharacters(in: CharacterSet(charactersIn: ",")) } + + /// Returns an array of all W3WSquare markers in the marker list. + /// + /// Since the markers property is internal to the W3WMarkerList class package, + /// this method provides public access to the markers collection. + /// + /// - Returns: An array of W3WSquare objects representing all markers in the list. + /// Returns an empty array if no markers are present. + /// + /// - Example: + /// ```swift + /// let markerList = W3WMarkerList() + /// let squares = markerList.getMarkers() + /// + /// for square in squares { + /// // Work with each W3WSquare marker + /// mapHelper.addMarker(at: square) + /// } + /// ``` + + public func getmarkers() -> [W3WSquare] { + return markers + } }