# GMTCTripModel

    @interface GMTCTripModel : NSObject

A 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.
- `


  ### [state](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCTripModel#/c:objc(cs)GMTCTripModel(py)state)


  ` Returns the current session state.

  #### Declaration

  Swift

      var state: https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Enums/GMTCTripModelState.html { get }

  Objective-C

      @property (nonatomic, readonly) https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Enums/GMTCTripModelState.html state;

- `


  ### [currentTrip](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCTripModel#/c:objc(cs)GMTCTripModel(py)currentTrip)


  ` Returns the current trip data.

  #### Declaration

  Swift

      var currentTrip: https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTSTrip.html? { get }

  Objective-C

      @property (nonatomic, readonly, nullable) https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTSTrip.html *currentTrip;

- `


  ### [tripName](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCTripModel#/c:objc(cs)GMTCTripModel(py)tripName)


  ` Returns the associated trip name.

  #### Declaration

  Swift

      var tripName: String { get }

  Objective-C

      @property (nonatomic, readonly) NSString *_Nonnull tripName;

- `


  ### [options](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCTripModel#/c:objc(cs)GMTCTripModel(py)options)


  ` Specifies the options of the current trip session. This property should only be accessed in the
  main thread.

  #### Declaration

  Swift

      var options: https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMutableTripModelOptions.html { get }

  Objective-C

      @property (nonatomic, readonly) https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMutableTripModelOptions.html *_Nonnull options;

- `


  ### [-registerSubscriber:](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCTripModel#/c:objc(cs)GMTCTripModel(im)registerSubscriber:)


  ` Register an instance of `https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCTripModelSubscriber.html` for 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.

  #### Declaration

  Swift

      func register(_ subscriber: any https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCTripModelSubscriber.html)

  Objective-C

      - (void)registerSubscriber:(nonnull id<https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCTripModelSubscriber.html>)subscriber;

  #### Parameters

  |---|---|
  | ` subscriber ` | The instance of `https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCTripModelSubscriber.html` to be registered. |

- `


  ### [-unregisterSubscriber:](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCTripModel#/c:objc(cs)GMTCTripModel(im)unregisterSubscriber:)


  ` Unregister an instance of `https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCTripModelSubscriber.html` for this session, for avoiding the callback.
  This is recommended when the instance of `https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCTripModelSubscriber.html` needs 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.

  #### Declaration

  Swift

      func unregisterSubscriber(_ subscriber: any https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCTripModelSubscriber.html)

  Objective-C

      - (void)unregisterSubscriber:(nonnull id<https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCTripModelSubscriber.html>)subscriber;

  #### Parameters

  |---|---|
  | ` subscriber ` | The instance of `https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCTripModelSubscriber.html` to be registered. |

- `


  ### [-init](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCTripModel#/c:objc(cs)GMTCTripModel(im)init)


  ` Unavailable
  Use `-tripModelForTripName:` of `https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCTripService.html` instead.

  #### Declaration

  Objective-C

      - (nonnull instancetype)init;