Skip to content

Commit

Permalink
Added FeatureCollection.enumerateProperties() (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
trasch authored Jul 29, 2024
1 parent 9b0211f commit 32b933f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Sources/GISTools/Algorithms/EnumerateProperties.swift
Original file line number Diff line number Diff line change
@@ -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)
}
}

}

0 comments on commit 32b933f

Please sign in to comment.