MBMObservable.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // This file is generated and will be overwritten automatically.
  2. #import <Foundation/Foundation.h>
  3. @protocol MBMObserver;
  4. /**
  5. * The `observable` interface provides basic Publish&Subscribe functionality. Classes that extend
  6. * this functionality and capable of generating events, have to specify event types and
  7. * corresponding data format for an event.
  8. */
  9. NS_SWIFT_NAME(Observable)
  10. __attribute__((visibility ("default")))
  11. @interface MBMObservable : NSObject
  12. /**
  13. * Subscribes an `observer` to a provided array of event types.
  14. * The `observable` will hold a strong reference to an `observer` instance, therefore,
  15. * in order to stop receiving notifications, caller must call `unsubscribe` with an
  16. * `observer` instance used for an initial subscription.
  17. *
  18. * @param observer An `observer` that will be subscribed to a given events.
  19. * @param events An array of event types to be subscribed to.
  20. */
  21. - (void)subscribeForObserver:(nonnull id<MBMObserver>)observer
  22. events:(nonnull NSArray<NSString *> *)events;
  23. /**
  24. * Unsubscribes an `observer` from a provided array of event types.
  25. *
  26. * @param observer An `observer` that will be unsubscribed from a given events.
  27. * @param events An array of event types to be unsubscribed from.
  28. */
  29. - (void)unsubscribeForObserver:(nonnull id<MBMObserver>)observer
  30. events:(nonnull NSArray<NSString *> *)events;
  31. /**
  32. * Unsubscribes an `observer` from all events.
  33. *
  34. * @param observer An `observer` that will be unsubscribed from all previously subscribed events.
  35. */
  36. - (void)unsubscribeForObserver:(nonnull id<MBMObserver>)observer;
  37. @end