AI-generated Key Takeaways
-
The
GMTCMapViewSession
protocol manages the state of a map view session, accessible via thestate
property, which referencesGMTCMapViewSessionState
. -
The
delegate
property of theGMTCMapViewSession
protocol allows for monitoring the current session state and referencesGMTCMapViewSessionDelegate
. -
The
hostMapView
property within the protocol provides access to the map view that is hosting the current session. -
The protocol includes methods,
didAddToMapView:
anddidRemoveFromMapView:
, which are triggered when a session is added to or removed from aGMTCMapView
, respectively.
GMTCMapViewSession
@protocol GMTCMapViewSession <NSObject>
@optional
/**
* Returns the current session state. The possible state can be referenced from
* `GMTCMapViewSessionState`.
*/
@property(nonatomic, nullable, weak) __kindof id<GMTCMapViewSessionDelegate> delegate;
@required
/**
* Returns the current session state. The possible state can be referenced from
* `GMTCMapViewSessionState`.
*/
@property(nonatomic, readonly) GMTCMapViewSessionState state;
/** Returns the host map view of the current session. */
@property(nonatomic, nullable, weak, readonly) GMTCMapView *hostMapView;
/** Called by a `GMTCMapView` instance when the session has been added to it. */
- (void)didAddToMapView:(GMTCMapView *)mapView;
/** Called by a `GMTCMapView` instance when the session has been removed from it. */
- (void)didRemoveFromMapView:(GMTCMapView *)mapView;
@end
-
Returns the current session state. The possible state can be referenced from
GMTCMapViewSessionState
.Declaration
Swift
weak optional var delegate: (any GMTCMapViewSessionDelegate)? { get set }
Objective-C
@optional @property (nonatomic, weak, readwrite, nullable) __kindof id<GMTCMapViewSessionDelegate> delegate;
-
Returns the current session state. The possible state can be referenced from
GMTCMapViewSessionState
.Declaration
Swift
var state: GMTCMapViewSessionState { get }
Objective-C
@required @property (nonatomic, readonly) GMTCMapViewSessionState state;
-
Returns the host map view of the current session.
Declaration
Swift
weak var hostMapView: GMTCMapView? { get }
Objective-C
@required @property (nonatomic, weak, readonly, nullable) GMTCMapView *hostMapView;
-
Called by a
GMTCMapView
instance when the session has been added to it.Declaration
Swift
func didAdd(to mapView: GMTCMapView)
Objective-C
- (void)didAddToMapView:(nonnull GMTCMapView *)mapView;
-
Called by a
GMTCMapView
instance when the session has been removed from it.Declaration
Swift
func didRemove(from mapView: GMTCMapView)
Objective-C
- (void)didRemoveFromMapView:(nonnull GMTCMapView *)mapView;