Как я могу определить, включен ли темный режим на моем Ма c в Objective- C?
Сейчас у меня есть это, но я не вижу никаких изменений.
Я делаю что-то явно не так?
-(void)viewDidLoad {
NSString *effectiveAppearance = @"effectiveAppearance";
NSString *appleInterfaceStyle = @"AppleInterfaceStyle";
[[NSUserDefaults standardUserDefaults]
addObserver:self
forKeyPath:appleInterfaceStyle
options:allKeys
context:context1];
[NSApp
addObserver:self
forKeyPath:effectiveAppearance
options:allKeys
context:context1];
}
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
NSLog(@"Changes are...: %@", change);
}