Skip to content

Commit

Permalink
MAPSIOS-1581: Geofence integration (#2319)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksproger authored Oct 10, 2024
1 parent e661d2a commit 2cef5b1
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@_spi(Experimental) @_spi(Internal) import MapboxCommon

@_spi(Experimental)
extension GeofenceState {
/// Create `GeofenceState`
@_spi(Experimental)
public init(feature: Turf.Feature, timestamp: Date?) {
self.init(_feature: MapboxCommon.Feature(feature), timestamp: timestamp)
}

/// The feature linked to this state
@_spi(Experimental)
public var feature: Turf.Feature { Turf.Feature(_feature) }
}

@_spi(Experimental)
extension GeofencingEvent {
/// Create `GeofenceEvent`
@_spi(Experimental)
public init(feature: Turf.Feature, timestamp: Date) {
self.init(_feature: MapboxCommon.Feature(feature), timestamp: timestamp)
}

/// The feature linked to this event
@_spi(Experimental)
public var feature: Turf.Feature { Turf.Feature(_feature) }
}

@_spi(Experimental)
extension GeofencingService {
/// Adds a feature to be monitored for geofencing activities.
/// You can add extra properties (see GeofencingPropertiesKeys) to the Feature to configure how geofencing engine behaves per each specific feature.
/// If a feature with the same ID already exist it will be overwritten and its state reset
@_spi(Experimental)
public func addFeature(feature: Turf.Feature, callback: @escaping (Result<String, GeofencingError>) -> Void) {
self.addFeature(feature: MapboxCommon.Feature(feature)) { result in
callback(result)
}
}
}

0 comments on commit 2cef5b1

Please sign in to comment.