/** @since Available in iOS 9.0 and later. */ public static NSObject observeAccountChanged(final Runnable block) { return NSNotificationCenter.getDefaultCenter() .addObserver( AccountChangedNotification(), null, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { block.run(); } }); }
public static NSObject observeWillExit(NSThread object, final VoidBlock1<NSThread> block) { return NSNotificationCenter.getDefaultCenter() .addObserver( WillExitNotification(), object, NSOperationQueue.getMainQueue(), new VoidBlock1<NSNotification>() { @Override public void invoke(NSNotification a) { block.invoke((NSThread) a.getObject()); } }); }