NSWorkspace

Back in the mists of time, the original NeXT-system UI was called the Workspace. These days it’s a combination of the Finder and the Dock. Cocoa’s NSWorkspace class provides features that were originally available in the NeXT workspace. NSWorkspace, actually, is a combination of Finder features as well as being a higher level API on top of Apple’s Launch Services. Launch Services is a database of applications, file types, icons, and associated data.

Because the system has one Launch Services database and the user has one Finder, you interact with NSWorkspace via a shared instance:

+ (NSWorkspace *) sharedWorkspace;

You can open files and URLs, and launch applications as if you had double-clicked them in the Finder. NSWorkspace

Get Advanced Mac OS X Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.