AI-generated Key Takeaways
- 
          GMSLocationSimulatoris a class used for simulating device location for testing purposes in iOS applications.
- 
          It provides methods to simulate movement along existing or new routes, set location at a fixed coordinate, and control simulation speed and behavior. 
- 
          Developers can use this class to test location-based features and functionalities within their apps without needing actual device movement. 
- 
          The simulator allows for pausing the simulation, avoiding certain road types like highways or tolls, and introducing random location jittering for realistic testing scenarios. 
- 
          It also includes methods to simulate navigation prompts and traffic incident reports for a more comprehensive testing environment. 
GMSLocationSimulator
@interface GMSLocationSimulator : NSObjectA class you can use to simulate a device location for testing purposes.
- 
                  
                  Unavailable DeclarationObjective-C - (instancetype)init NS_UNAVAILABLE;
- 
                  
                  Starts simulating travel along the route currently set on the GMSNavigator. If theGMSNavigatordoes not have a route, this does nothing.DeclarationSwift func simulateLocationsAlongExistingRoute()Objective-C - (void)simulateLocationsAlongExistingRoute;
- 
                  
                  Calculates a route to the given waypoints and simulates travel along this route. The new route will use the travel mode that is set on the GMSMapView.Travel will be started just before the callback is called with GMSRouteStatusOK. If the callback returns any value other thanGMSRouteStatusOK, no simulation will start. If any other simulator methods are called before the route is generated, route generation will be canceled and the callback will be called withGMSRouteStatusCanceled.DeclarationSwift func simulateAlongNewRoute(toDestinations destinations: [GMSNavigationWaypoint], callback: @escaping GMSRouteStatusCallback)Objective-C - (void)simulateAlongNewRouteToDestinations: (nonnull NSArray<GMSNavigationWaypoint *> *)destinations callback: (nonnull GMSRouteStatusCallback)callback;ParametersdestinationsThe list of destinations for the route that will be simulated. callbackA block that will be called when the route becomes available or fails. 
- 
                  
                  Calculates a route to the given waypoints, and simulates travel along this route. The new route will use the travel mode which is set on the GMSMapView.Travel starts right before the callback is invoked with GMSRouteStatusOK. If the callback returns a value other thanGMSRouteStatusOK, then no simulation starts. If any other simulator methods are called before the route is generated, then route generation will be canceled, and the callback will be called withGMSRouteStatusCanceled.DeclarationSwift func simulateAlongNewRoute(toDestinations destinations: [GMSNavigationWaypoint], routingOptions: GMSNavigationRoutingOptions, callback: @escaping GMSRouteStatusCallback)Objective-C - (void)simulateAlongNewRouteToDestinations: (nonnull NSArray<GMSNavigationWaypoint *> *)destinations routingOptions: (nonnull GMSNavigationRoutingOptions *) routingOptions callback: (nonnull GMSRouteStatusCallback)callback;ParametersdestinationsThe list of destinations for the route that will be simulated. routingOptionsThe routing logic that will determine the returned route. callbackA block that will be called when the route becomes available or fails. 
- 
                  
                  Starts simulating the device location at a fixed coordinate. DeclarationSwift func simulateLocation(at coordinate: CLLocationCoordinate2D)Objective-C - (void)simulateLocationAtCoordinate:(CLLocationCoordinate2D)coordinate;
- 
                  
                  Stops simulating the device location if it is currently being simulated. DeclarationSwift func stopSimulation()Objective-C - (void)stopSimulation;
- 
                  
                  Diplays a navigation prompt with fake data for testing purposes. DeclarationSwift func simulateNavigationPrompt()Objective-C - (void)simulateNavigationPrompt;
- 
                  
                  Displays a dummy traffic prompt for testing purposes. DeclarationSwift func simulateTrafficIncidentReport()Objective-C - (void)simulateTrafficIncidentReport;
- 
                  
                  Whether the simulation is currently paused. If this is set to YESwhilst simulating along a route, then location updates will still be sent periodically, but the location will stop advancing along the route.DeclarationSwift var isPaused: Bool { get set }Objective-C @property (nonatomic, getter=isPaused) BOOL paused;
- 
                  
                  Whether to avoid highways when simulating travel to destinations with the -simulateAlongNewRouteToDestinations:callback:method. Defaults to NO.DeclarationSwift var avoidsHighways: Bool { get set }Objective-C @property (nonatomic) BOOL avoidsHighways;
- 
                  
                  Whether to avoid toll roads when simulating travel to destinations with the -simulateAlongNewRouteToDestinations:callback:method. Defaults to NO.DeclarationSwift var avoidsTolls: Bool { get set }Objective-C @property (nonatomic) BOOL avoidsTolls;
- 
                  
                  Whether to avoid ferries when simulating travel to destinations with the -simulateAlongNewRouteToDestinations:callback:method. Defaults to YES.DeclarationSwift var avoidsFerries: Bool { get set }Objective-C @property (nonatomic) BOOL avoidsFerries;
- 
                  
                  The speed multiplier to use when simulating travel along a route. The value of this property must be positive. Attempting to set a non-positive value will have no effect. The default value is 1.0. DeclarationSwift var speedMultiplier: Float { get set }Objective-C @property (nonatomic) float speedMultiplier;
- 
                  
                  Whether the simulated location should jitter randomly. DeclarationSwift var isLocationJitteringEnabled: Bool { get set }Objective-C @property (nonatomic, assign, unsafe_unretained, readwrite, getter=isLocationJitteringEnabled) BOOL locationJitteringEnabled;
- 
                  
                  Set license plate restriction with current vehicle’s last digit of license plate and country code. This allows us to route around certain types of road restrictions which are based on license plate number. This will only apply to -simulateAlongNewRouteToDestinationscalls made after this value is set.Set to nil if there is no license plate restriction. Default to nil. DeclarationSwift var licensePlateRestriction: GMSNavigationLicensePlateRestriction? { get set }Objective-C @property (nonatomic, nullable) GMSNavigationLicensePlateRestriction *licensePlateRestriction;