Skip to content

Instantly share code, notes, and snippets.

@marvi
Created May 10, 2015 10:06
Show Gist options
  • Select an option

  • Save marvi/641717c10a957475c682 to your computer and use it in GitHub Desktop.

Select an option

Save marvi/641717c10a957475c682 to your computer and use it in GitHub Desktop.
func isEveRunning() -> Bool {
let regularApps = NSWorkspace().runningApplications.filter{$0.activationPolicy == NSApplicationActivationPolicy.Regular}.map{$0.bundleIdentifier!!}
return contains(regularApps, "com.transgaming.EVEOnline")
}
@marvi
Copy link
Author

marvi commented May 10, 2015

After computer suspend/resume this crashes with fatal error: unexpectedly found nil while unwrapping an Optional value

How do I check for nil in a filter closure?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment