Skip to main content
RadarTripOptions is a configuration class used to set up trip tracking with destination information. It supports single-destination trips and multi-destination trips with multiple legs.

Initializers

initWithExternalId:destinationGeofenceTag:destinationGeofenceExternalId:

init(externalId: String, 
     destinationGeofenceTag: String?, 
     destinationGeofenceExternalId: String?)
- (instancetype)initWithExternalId:(NSString *_Nonnull)externalId
            destinationGeofenceTag:(NSString *_Nullable)destinationGeofenceTag
     destinationGeofenceExternalId:(NSString *_Nullable)destinationGeofenceExternalId;
Initializes trip options with a destination geofence identified by tag and external ID.
externalId
String
required
A stable unique ID for the trip.
destinationGeofenceTag
String
The tag of the destination geofence.
destinationGeofenceExternalId
String
The external ID of the destination geofence.

initWithExternalId:destinationGeofenceTag:destinationGeofenceExternalId:scheduledArrivalAt:

init(externalId: String,
     destinationGeofenceTag: String?,
     destinationGeofenceExternalId: String?,
     scheduledArrivalAt: Date?)
- (instancetype)initWithExternalId:(NSString *_Nonnull)externalId
            destinationGeofenceTag:(NSString *_Nullable)destinationGeofenceTag
     destinationGeofenceExternalId:(NSString *_Nullable)destinationGeofenceExternalId
                scheduledArrivalAt:(NSDate *_Nullable)scheduledArrivalAt;
Initializes trip options with a destination geofence and scheduled arrival time.
externalId
String
required
A stable unique ID for the trip.
destinationGeofenceTag
String
The tag of the destination geofence.
destinationGeofenceExternalId
String
The external ID of the destination geofence.
scheduledArrivalAt
Date
The scheduled arrival time for the trip.

initWithExternalId:destinationGeofenceTag:destinationGeofenceExternalId:scheduledArrivalAt:startTracking:

init(externalId: String,
     destinationGeofenceTag: String?,
     destinationGeofenceExternalId: String?,
     scheduledArrivalAt: Date?,
     startTracking: Bool)
- (instancetype)initWithExternalId:(NSString *_Nonnull)externalId
            destinationGeofenceTag:(NSString *_Nullable)destinationGeofenceTag
     destinationGeofenceExternalId:(NSString *_Nullable)destinationGeofenceExternalId
                scheduledArrivalAt:(NSDate *_Nullable)scheduledArrivalAt
                     startTracking:(BOOL)startTracking;
Initializes trip options with full configuration including whether to start tracking automatically.
externalId
String
required
A stable unique ID for the trip.
destinationGeofenceTag
String
The tag of the destination geofence.
destinationGeofenceExternalId
String
The external ID of the destination geofence.
scheduledArrivalAt
Date
The scheduled arrival time for the trip.
startTracking
Bool
required
Whether to automatically start tracking when the trip is created. Defaults to true when not specified.

Properties

externalId
String
A stable unique ID for the trip. This is required and should be unique across all trips.
metadata
NSDictionary
An optional set of custom key-value pairs for the trip. Use this to attach any custom data to the trip.
destinationGeofenceTag
String
For trips with a destination, the tag of the destination geofence. Used together with destinationGeofenceExternalId to identify the destination.
destinationGeofenceExternalId
String
For trips with a destination, the external ID of the destination geofence. Used together with destinationGeofenceTag to identify the destination.
scheduledArrivalAt
NSDate
The scheduled arrival time for the trip. Used to calculate whether the trip is on time or delayed.
mode
RadarRouteMode
For trips with a destination, the travel mode used to calculate ETA and distance.Values:
  • RadarRouteModeFoot - Walking
  • RadarRouteModeBike - Biking
  • RadarRouteModeCar - Driving (default)
  • RadarRouteModeTruck - Truck
  • RadarRouteModeMotorbike - Motorcycle
approachingThreshold
UInt16
The distance threshold in meters for triggering the approaching state. When the device is within this distance of the destination, the trip status will change to approaching.
startTracking
BOOL
Whether to automatically start tracking when the trip is created. Defaults to true.
legs
NSArray<RadarTripLeg *>
For multi-destination trips, an optional array of trip legs. Each leg represents a stop along the trip route.See RadarTripLeg for more details.

Class Methods

tripOptionsFromDictionary

class func tripOptions(from dictionary: [AnyHashable : Any]) -> RadarTripOptions?
+ (RadarTripOptions *_Nullable)tripOptionsFromDictionary:(NSDictionary *)dict;
Creates a RadarTripOptions instance from a dictionary.
dict
NSDictionary
required
A dictionary containing trip options configuration.
Returns: A RadarTripOptions instance, or nil if the dictionary is invalid.

Instance Methods

dictionaryValue

func dictionaryValue() -> [AnyHashable : Any]
- (NSDictionary *)dictionaryValue;
Converts the trip options instance to a dictionary representation. Returns: A dictionary containing all trip options properties.

Usage Examples

Single Destination Trip

// Create trip options with a destination geofence
let tripOptions = RadarTripOptions(
    externalId: "order-123",
    destinationGeofenceTag: "store",
    destinationGeofenceExternalId: "store-456"
)

// Optionally set additional properties
tripOptions.mode = .car
tripOptions.metadata = ["orderId": "123", "customerId": "456"]

// Start the trip
Radar.startTrip(options: tripOptions)
// Create trip options with a destination geofence
RadarTripOptions *tripOptions = [[RadarTripOptions alloc] 
    initWithExternalId:@"order-123"
    destinationGeofenceTag:@"store"
    destinationGeofenceExternalId:@"store-456"];

// Optionally set additional properties
tripOptions.mode = RadarRouteModeCar;
tripOptions.metadata = @{@"orderId": @"123", @"customerId": @"456"};

// Start the trip
[Radar startTripWithOptions:tripOptions];

Trip with Scheduled Arrival

// Create trip with scheduled arrival time
let arrivalTime = Date(timeIntervalSinceNow: 1800) // 30 minutes from now

let tripOptions = RadarTripOptions(
    externalId: "delivery-789",
    destinationGeofenceTag: "customer",
    destinationGeofenceExternalId: "customer-123",
    scheduledArrivalAt: arrivalTime
)

tripOptions.mode = .car
tripOptions.approachingThreshold = 500 // 500 meters

Radar.startTrip(options: tripOptions)
// Create trip with scheduled arrival time
NSDate *arrivalTime = [NSDate dateWithTimeIntervalSinceNow:1800]; // 30 minutes from now

RadarTripOptions *tripOptions = [[RadarTripOptions alloc]
    initWithExternalId:@"delivery-789"
    destinationGeofenceTag:@"customer"
    destinationGeofenceExternalId:@"customer-123"
    scheduledArrivalAt:arrivalTime];

tripOptions.mode = RadarRouteModeCar;
tripOptions.approachingThreshold = 500; // 500 meters

[Radar startTripWithOptions:tripOptions];

Multi-Destination Trip

// Create trip legs
let leg1 = RadarTripLeg(
    destinationGeofenceTag: "store",
    destinationGeofenceExternalId: "store-1"
)
leg1.stopDuration = 10 // 10 minutes

let leg2 = RadarTripLeg(
    destinationGeofenceTag: "store",
    destinationGeofenceExternalId: "store-2"
)
leg2.stopDuration = 15 // 15 minutes

// Create trip options with legs
let tripOptions = RadarTripOptions(
    externalId: "route-456",
    destinationGeofenceTag: nil,
    destinationGeofenceExternalId: nil
)
tripOptions.legs = [leg1, leg2]
tripOptions.mode = .car

Radar.startTrip(options: tripOptions)
// Create trip legs
RadarTripLeg *leg1 = [[RadarTripLeg alloc]
    initWithDestinationGeofenceTag:@"store"
    destinationGeofenceExternalId:@"store-1"];
leg1.stopDuration = 10; // 10 minutes

RadarTripLeg *leg2 = [[RadarTripLeg alloc]
    initWithDestinationGeofenceTag:@"store"
    destinationGeofenceExternalId:@"store-2"];
leg2.stopDuration = 15; // 15 minutes

// Create trip options with legs
RadarTripOptions *tripOptions = [[RadarTripOptions alloc]
    initWithExternalId:@"route-456"
    destinationGeofenceTag:nil
    destinationGeofenceExternalId:nil];
tripOptions.legs = @[leg1, leg2];
tripOptions.mode = RadarRouteModeCar;

[Radar startTripWithOptions:tripOptions];