Linked Questions

Popular Questions

NSNotification.Name.didBecomeActiveNotification not found

Asked by At

I'm working on a macOS app on Xcode 10.1 with a 10.14 deployment target. According to the documentation there should be a NSNotification.Name.didBecomeActiveNotification, but the build fails with a Type 'NSNotification.Name?' has no member 'didBecomeActiveNotification' error. I have imported Cocoa, AppKit and Foundation. Here is the relevant code:

NotificationCenter.default.addObserver(forName: .didBecomeActiveNotification, object: nil, queue: nil) { notification in
    print("\(notification)")
}

What is the problem?

Related Questions