# GMTCMapViewSession

    @protocol GMTCMapViewSession <NSObject>
    @optional
    /**
     * Returns the current session state. The possible state can be referenced from
     * `GMTCMapViewSessionState`.
     */
    @property(nonatomic, nullable, weak) __kindof id<https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCMapViewSessionDelegate.html> delegate;

    @required
    /**
     * Returns the current session state. The possible state can be referenced from
     * `GMTCMapViewSessionState`.
     */
    @property(nonatomic, readonly) https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Enums/GMTCMapViewSessionState.html state;

    /** Returns the host map view of the current session. */
    @property(nonatomic, nullable, weak, readonly) https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMapView.html *hostMapView;

    /** Called by a `GMTCMapView` instance when the session has been added to it. */
    - (void)didAddToMapView:(https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMapView.html *)mapView;

    /** Called by a `GMTCMapView` instance when the session has been removed from it. */
    - (void)didRemoveFromMapView:(https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMapView.html *)mapView;

    @end

- `


  ### [delegate](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCMapViewSession#/c:objc(pl)GMTCMapViewSession(py)delegate)


  ` Returns the current session state. The possible state can be referenced from
  `https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Enums/GMTCMapViewSessionState.html`.

  #### Declaration

  Swift

      weak optional var delegate: (any https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCMapViewSessionDelegate.html)? { get set }

  Objective-C

      @optional
      @property (nonatomic, weak, readwrite, nullable)
          __kindof id<https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCMapViewSessionDelegate.html>
              delegate;

- `


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


  ` Returns the current session state. The possible state can be referenced from
  `https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Enums/GMTCMapViewSessionState.html`.

  #### Declaration

  Swift

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

  Objective-C

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

- `


  ### [hostMapView](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCMapViewSession#/c:objc(pl)GMTCMapViewSession(py)hostMapView)


  ` Returns the host map view of the current session.

  #### Declaration

  Swift

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

  Objective-C

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

- `


  ### [-didAddToMapView:](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCMapViewSession#/c:objc(pl)GMTCMapViewSession(im)didAddToMapView:)


  ` Called by a `https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMapView.html` instance when the session has been added to it.

  #### Declaration

  Swift

      func didAdd(to mapView: https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMapView.html)

  Objective-C

      - (void)didAddToMapView:(nonnull https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMapView.html *)mapView;

- `


  ### [-didRemoveFromMapView:](https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Protocols/GMTCMapViewSession#/c:objc(pl)GMTCMapViewSession(im)didRemoveFromMapView:)


  ` Called by a `https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMapView.html` instance when the session has been removed from it.

  #### Declaration

  Swift

      func didRemove(from mapView: https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMapView.html)

  Objective-C

      - (void)didRemoveFromMapView:(nonnull https://developers.google.com/maps/documentation/mobility/journey-sharing/on-demand/reference/ios/Classes/GMTCMapView.html *)mapView;