Documentation Index
Fetch the complete documentation index at: https://mintlify.com/radarlabs/radar-sdk-ios/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheRadarDelegate protocol provides client-side delivery of location updates, events, and debug logs. Implementing this delegate allows you to respond to location changes and Radar events in real-time within your app.
Setting the Delegate
Set your delegate implementation after initializing the Radar SDK:All delegate methods are optional. Implement only the methods you need for your use case.
Delegate Methods
didReceiveEvents
Called when events are generated by Radar, such as geofence entries/exits, place visits, or trip updates.events: Array ofRadarEventobjects representing the events that were generateduser: The updatedRadarUserobject, ornilif anonymous tracking is enabled
didUpdateLocation
Called when the user’s location is updated and successfully synced to the server.location: TheCLLocationobject representing the user’s current locationuser: The updatedRadarUserobject with current context and state
This method is only called for location updates that are successfully synced to the server. Use
didUpdateClientLocation if you need all location updates.didUpdateClientLocation
Called when the device’s location is updated, even if not synced to the server. Use this for more frequent location updates.location: TheCLLocationobject representing the device’s locationstopped: A boolean indicating whether the device is considered stoppedsource: TheRadarLocationSourceindicating what triggered the location update
This method provides all location updates, including those that may not be synced to the server. Use this for real-time UI updates or analytics.
didFail
Called when a Radar request fails.status: TheRadarStatuserror code indicating what went wrong
didLog
Called when the SDK generates debug log messages. Useful for debugging and troubleshooting.message: The debug log message string
Enable log messages by setting the log level:
Radar.setLogLevel(.debug)Event Types
TheRadarEventType enum includes the following event types:
Geofence Events
Geofence Events
userEnteredGeofence- User entered a geofenceuserExitedGeofence- User exited a geofenceuserDwelledInGeofence- User dwelled in a geofence
Place Events
Place Events
userEnteredPlace- User entered a placeuserExitedPlace- User exited a placeuserNearbyPlaceChain- User is near a place chain
Region Events
Region Events
userEnteredRegionCountry- User entered a countryuserExitedRegionCountry- User exited a countryuserEnteredRegionState- User entered a stateuserExitedRegionState- User exited a stateuserEnteredRegionDMA- User entered a DMAuserExitedRegionDMA- User exited a DMAuserEnteredRegionPostalCode- User entered a postal codeuserExitedRegionPostalCode- User exited a postal code
Trip Events
Trip Events
userStartedTrip- User started a tripuserUpdatedTrip- User’s trip was updateduserApproachingTripDestination- User is approaching trip destinationuserArrivedAtTripDestination- User arrived at trip destinationuserArrivedAtWrongTripDestination- User arrived at wrong destinationuserStoppedTrip- User stopped a tripuserFiredTripOrders- Trip orders were fired
Beacon Events
Beacon Events
userEnteredBeacon- User entered a beacon regionuserExitedBeacon- User exited a beacon region
Other Events
Other Events
userFailedFraud- User failed fraud verificationconversion- Conversion event (fromRadar.logConversion())
Complete Example
Here’s a complete example of implementingRadarDelegate:
Best Practices
Keep delegate methods lightweight
Delegate methods are called on the main thread. Avoid heavy processing or blocking operations.
Handle all error cases
Implement
didFail to gracefully handle errors like permission denials or network issues.Use appropriate callback
Use
didUpdateLocation for server-synced updates, didUpdateClientLocation for all location changes.Filter events in the delegate
Filter events by type in
didReceiveEvents rather than processing all events.