Platforms to show: All Mac Windows Linux Cross-Platform

NSSharingServiceMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Social MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The NSSharingService class is used to provide a consistent user experience when sharing items on OS X.
Example
// create a new email with a text and a file attachment in the Mail app
Var service As NSSharingServiceMBS = NSSharingServiceMBS.sharingServiceNamed(NSSharingServiceMBS.NSSharingServiceNameComposeEmail)
If service = Nil Then Return

Var recipients() As String = Array("info@example.com")
service.setRecipients recipients
service.subject = "Report"

Var items As New NSSharingServiceItemsMBS
items.AddText "Here is the report."
items.AddFile SpecialFolder.Desktop.Child("report.pdf")

If service.canPerformWithItems(items) Then
service.performWithItems items
End If

For example, items can be: NSURL objects, NSString objects, NSImage objects, video (through file URLs), or any object which implements the NSPasteboardWriting protocol.

For any item or group of items, the NSSharingServiceMBS 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.

Sub classes:

Blog Entries

Release notes

Some events using this class:

Some examples using this class:

Some related classes:


The items on this page are in the following plugins: MBS MacFrameworks Plugin.


NSSharingServiceItemsMBS   -   NSSharingServicePickerMBS


The biggest plugin in space...