NotificationCenter

class NotificationCenter : NSObject

To import the cancellable NSNotificationCenter category:

use_frameworks! pod CancelForPromiseKit/Foundation

Or cancellable NSNotificationCenter is one of the categories imported by the umbrella pod:

use_frameworks! pod CancelForPromiseKit

And then in your sources:

import PromiseKit import CancelForPromiseKit

  • Observe the named notification once

    Declaration

    Swift

    public func observeCC(once name: Notification.Name, object: Any? = nil) -> CancellablePromise<Notification>