I want to get notified in my Swift Cocoa Application (not sandboxed) when a TimeMachine starts or ends.
So far I tried to listen for every Notification coming in the DistributedNotificationCenter by setting the name:
parameter to nil as suggested in this question.
But it seems like passing in nil as an argument is not supported anymore (I am currently on macOS Monterey) because I do not get a single notification at all.
This is the code I tried:
DistributedNotificationCenter.default().addObserver(self, selector: #selector(test(_:)), name: nil, object: nil)
@objc func test(_ aNotification: Notification) {
print(aNotification)
}
I tried to find a specific notification name for TimeMachine but found nothing.