AI-generated Key Takeaways
- 
          The GMTCTripModelclass represents a trip session, which can be a ridesharing or delivery trip, identified by a uniqueTripName.
- 
          The current state of the trip session can be accessed using the stateproperty, and the current trip data can be retrieved through thecurrentTripproperty.
- 
          The tripNameproperty provides the specific identifier for the current trip session.
- 
          GMTCTripModeluses theoptionsproperty to define the options of the current trip session, and they must be accessed on the main thread.
- 
          Subscribers can register to get callbacks using registerSubscriber:and unregister usingunregisterSubscriber:, both methods are limited to main thread calls, and the trip data is updated automatically once there is a registered subscriber.
GMTCTripModel
@interface GMTCTripModel : NSObjectA class representing a trip session. A trip session will provide trip info update periodically after started, it can be either a ridesharing or a delivery trip, and each trip session is identified by a TripName.
- 
                  
                  Returns the current session state. DeclarationSwift var state: GMTCTripModelState { get }Objective-C @property (nonatomic, readonly) GMTCTripModelState state;
- 
                  
                  Returns the associated trip name. DeclarationSwift var tripName: String { get }Objective-C @property (nonatomic, readonly) NSString *_Nonnull tripName;
- 
                  
                  Specifies the options of the current trip session. This property should only be accessed in the main thread. DeclarationSwift var options: GMTCMutableTripModelOptions { get }Objective-C @property (nonatomic, readonly) GMTCMutableTripModelOptions *_Nonnull options;
- 
                  
                  Register an instance of GMTCTripModelSubscriberfor this session. Call this API before you can get any callbacks. This method is only allowed to be called in the main thread.Note that the tripModel will be active (e.g. trip data is being updated/refreshed) automatically once a subscriber is registered. DeclarationSwift func register(_ subscriber: any GMTCTripModelSubscriber)Objective-C - (void)registerSubscriber:(nonnull id<GMTCTripModelSubscriber>)subscriber;ParameterssubscriberThe instance of GMTCTripModelSubscriberto be registered.
- 
                  
                  Unregister an instance of GMTCTripModelSubscriberfor this session, for avoiding the callback. This is recommended when the instance ofGMTCTripModelSubscriberneeds to be dealloced. This method is only allowed to be called in the main thread.Note that if there are no subscribers registered, the tripModel will automatically stop the trip session. DeclarationSwift func unregisterSubscriber(_ subscriber: any GMTCTripModelSubscriber)Objective-C - (void)unregisterSubscriber:(nonnull id<GMTCTripModelSubscriber>)subscriber;ParameterssubscriberThe instance of GMTCTripModelSubscriberto be registered.
- 
                  
                  Unavailable Use -tripModelForTripName:ofGMTCTripServiceinstead.DeclarationObjective-C - (nonnull instancetype)init;