NotificationObserver
public final class NotificationObserver:NSObject, Observer
Implementation of Observer for observing an NSNotificationCenter. Observation begins on init and ends on deinit() unless called otherwise.
For efficiency the class is marked as final. If necessary, convenience initialisers can be created using extensions.
-
The name being observed on the
center.Declaration
Swift
public let name:String -
The
NSNotificationCenterto listen for notifications on.Declaration
Swift
public let center:NSNotificationCenter -
The object to restrict observed notifications to.
Declaration
Swift
public let object:AnyObject? -
Default initialiser.
Declaration
Swift
public init(name:String, object:AnyObject?, center:NSNotificationCenter = NSNotificationCenter.defaultCenter(), completion:(note:NSNotification) -> ())Parameters
nameThe notification name to listen for.
objectThe object to restrict observed notifications from.
centerThe
NSNotificationCenterto observe. The default value isNSNotificationCenter.defaultCenter().completionThe block to perform when
namebyobjectis observed oncenter.
View on GitHub
NotificationObserver Class Reference