Как определить, когда новый дисплей подключен или отключен в macOS (Swift или Objective-C).
Я пробовал что-то подобное, но, похоже, не работает:
NSDistributedNotificationCenter *nc = [NSDistributedNotificationCenter defaultCenter];
[nc addObserverForName:NSApplicationDidChangeScreenParametersNotification
object:[NSApplication sharedApplication]
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *notification) {
NSLog(@"Notification %@", notification);
}];