How can I observe changes to Night Shift on macOS / iOS?

Viewed 1252

I'm looking for a way to determine when Night Shift has been enabled or disabled and perform an action based on that. I'm currently using the CBBlueLightClient header in the CoreBrightness framework to control Night Shift. Here's a partial header I'm using in my app:

@interface CBBlueLightClient : NSObject
- (BOOL)setStrength:(float)strength commit:(BOOL)commit;
- (BOOL)setEnabled:(BOOL)enabled;
- (BOOL)getStrength:(float*)strength;
- (BOOL)getBlueLightStatus:(struct { BOOL x1; BOOL x2; BOOL x3; int x4; struct { struct { int x_1_2_1; int x_1_2_2; } x_5_1_1; struct {
 int x_2_2_1; int x_2_2_2; } x_5_1_2; } x5; unsigned long x6; }*)arg1;
 @end

CBBlueLightClient also has a notification block, - (void)setStatusNotificationBlock:(id /* block */)arg1; which I can't figure out how to use.

Here's the full header for iOS. Everything I've tried works with macOS, including the notification block which seems to be there. I just can't figure out what kind of closure it's expecting.

2 Answers
Related