Skip to main content
Represents the context for a location. The context includes geofences, places, and regions that are relevant to a specific location. Learn more in the Context API documentation.

Properties

geofences
[RadarGeofence]
required
An array of the geofences for the location. May be empty if the location is not in any geofences.See the Geofences documentation for more information.
place
RadarPlace
The place for the location. May be nil if the location is not at a place or if Places is not enabled.See the Places documentation for more information.
country
RadarRegion
The country of the location. May be nil if country is not available or if Regions is not enabled.See the Regions documentation for more information.
state
RadarRegion
The state of the location. May be nil if state is not available or if Regions is not enabled.See the Regions documentation for more information.
dma
RadarRegion
The designated market area (DMA) of the location. May be nil if DMA is not available or if Regions is not enabled.See the Regions documentation for more information.
postalCode
RadarRegion
The postal code of the location. May be nil if postal code is not available or if Regions is not enabled.See the Regions documentation for more information.

Methods

dictionaryValue

func dictionaryValue() -> [AnyHashable: Any]
- (NSDictionary *_Nonnull)dictionaryValue;
Converts the context to a dictionary representation. Returns: A dictionary representation of the context.

Nested Objects

Example Usage

Radar.getContext { (status, location, context) in
    if status == .success, let context = context {
        // Access geofences
        for geofence in context.geofences {
            print("In geofence: \(geofence.__description)")
        }
        
        // Check place
        if let place = context.place {
            print("At place: \(place.name)")
        }
        
        // Check regions
        if let country = context.country {
            print("Country: \(country.name)")
        }
        if let state = context.state {
            print("State: \(state.name)")
        }
    }
}
[Radar getContextWithCompletionHandler:^(RadarStatus status, CLLocation * _Nullable location, RadarContext * _Nullable context) {
    if (status == RadarStatusSuccess && context) {
        // Access geofences
        for (RadarGeofence *geofence in context.geofences) {
            NSLog(@"In geofence: %@", geofence.__description);
        }
        
        // Check place
        if (context.place) {
            NSLog(@"At place: %@", context.place.name);
        }
        
        // Check regions
        if (context.country) {
            NSLog(@"Country: %@", context.country.name);
        }
        if (context.state) {
            NSLog(@"State: %@", context.state.name);
        }
    }
}];

See Also

Build docs developers (and LLMs) love