diff --git a/Sources/GISTools/Algorithms/EnumerateProperties.swift b/Sources/GISTools/Algorithms/EnumerateProperties.swift new file mode 100644 index 0000000..1020b3e --- /dev/null +++ b/Sources/GISTools/Algorithms/EnumerateProperties.swift @@ -0,0 +1,17 @@ +#if !os(Linux) +import CoreLocation +#endif +import Foundation + +extension FeatureCollection { + + /// Enumerate all properties in the FeatureCollection with feature index.. + /// + /// - Parameter callback: The callback function + public func enumerateProperties(_ callback: (_ featureIndex: Int, _ properties: [String: Sendable]) -> Void) { + for (featureIndex, feature) in features.enumerated() { + callback(featureIndex, feature.properties) + } + } + +}