MGLObservable
@protocol MGLObservable
The MGLObservable protocol declares methods that conforming classes should
implement should they want to observe low-level events of type MGLEvent.
Currently only MGLMapView implements MGLObservable.
-
Subscribes an
MGLObserverto a provided set of event types.MGLObservablewill hold a strong reference to anMGLObserverinstance, therefore, in order to stop receiving notifications (and to avoid memory leaks), the caller must call unsubscribe with theMGLObserverinstance used for the initial subscription.Declaration
Objective-C
- (void)subscribeForObserver:(nonnull MGLObserver *)observer events:(nonnull NSSet<MGLEventType> *)events;Swift
func subscribe(for observer: MGLObserver, events: Set<MGLEventType>)Parameters
observeran MGLObserver
eventsa set of event types to subscribe to.
-
Unsubscribes an
MGLObserverfrom a provided set of event types.Declaration
Objective-C
- (void)unsubscribeForObserver:(nonnull MGLObserver *)observer events:(nonnull NSSet<MGLEventType> *)events;Swift
func unsubscribe(for observer: MGLObserver, events: Set<MGLEventType>)Parameters
observeran MGLObserver
eventsa set of event types to unsubscribe from.
-
Unsubscribes an
MGLObserverfrom all events (and release the strong reference).Declaration
Objective-C
- (void)unsubscribeForObserver:(nonnull MGLObserver *)observer;Swift
func unsubscribe(for observer: MGLObserver)Parameters
observeran MGLObserver
Install in Dash
MGLObservable Protocol Reference