NSSharing class is used to provide a consistent user experience when sharing items in macOS. For example, items can be: NSURL objects, NSString objects, NSImage objects, video (through file URLs), or any object which implements the
- macOS 10.8+
For any item or group of items, the
NSSharing will display a sharing sheet to allow the user to pre-visualize what will be shared to the service. A sharing service can: create a post on a social network like Twitter or Facebook, send a message by email or iMessage, upload videos to viewing services, or send a file by AirDrop.
It's possible for developers to use NSSharingService directly. For instance, they can create a button that will trigger a service as shown in this code snippet: