Cocoa: Reverting to a previous active application?

Is there a way to capture an application that was previously active before my application was brought to the user by the user?

I tried this in applicationWillBecomeActive: delegate method, but my application is already marked as active.

Thanks.

+3
source share
1 answer

Register the NSWorkspaceDidDeactivateApplicationNotification notification with NSWorkspace. This will give you an NSRunningApplication instance of what was disabled.

+9
source

Source: https://habr.com/ru/post/1722026/