The best I have been able to figure out is:
func applicationShouldHandleReopen(sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
if !flag{
In case you are looking for a cocoa-based solution for non-document apps. This is the equivalent of Adam's second solution.
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
{
if(!flag)
{
for(id const window in theApplication.windows)
{
[window makeKeyAndOrderFront:self];
}
}
return YES;
}