Platforms to show: All Mac Windows Linux Cross-Platform

NSSharingServiceDelegateMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class Social MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The NSSharingServiceDelegate protocol allows customization of the position and animation of the share sheet as well as be notified of the success or failure of the item being shared.
Example
// share a file by email and get notified when it was sent
// MySharingDelegate is a subclass of NSSharingServiceDelegateMBS with the events implemented.
// SharingDelegate is a property of the window: SharingDelegate As MySharingDelegate
Var service As NSSharingServiceMBS = NSSharingServiceMBS.sharingServiceNamed(NSSharingServiceMBS.NSSharingServiceNameComposeEmail)
If service = Nil Then Return

SharingDelegate = New MySharingDelegate
service.SetDelegate SharingDelegate

Var items As New NSSharingServiceItemsMBS
items.AddFile SpecialFolder.Desktop.Child("report.pdf")
service.performWithItems items

// in MySharingDelegate:
Sub didShareItems(service As NSSharingServiceMBS, items As NSSharingServiceItemsMBS) Handles didShareItems
System.DebugLog "Shared."
End Sub

Sub didFailToShareItems(service As NSSharingServiceMBS, items As NSSharingServiceItemsMBS, error As NSErrorMBS) Handles didFailToShareItems
System.DebugLog error.localizedDescription
End Sub

Available in OS X v10.8 and later.

Cloud Sharing Service Options

Constant Value Description
NSCloudKitSharingServiceAllowPrivate 2 The user is allowed to share privately.
NSCloudKitSharingServiceAllowPublic 1 The user is allowed to share publicly.
NSCloudKitSharingServiceAllowReadOnly 16 The user is allowed to grant participants read-only permissions.
NSCloudKitSharingServiceAllowReadWrite 32 The user is allowed to grant participants read/write permissions.
NSCloudKitSharingServiceStandard 0 Allow the user to configure the share with the standard set of options.

Sharing Scope Constants

Constant Value Description
NSSharingContentScopeFull 2 Used when sharing the whole content of the current document, for example, the URL of the webpage.
Available in OS X v10.8 and later.
NSSharingContentScopeItem 0 Used when sharing a clearly identified item, for example, a file represented by its icon.
Available in OS X v10.8 and later.
NSSharingContentScopePartial 1 Used when sharing a portion of a more global content, for example, part of a webpage.
Available in OS X v10.8 and later.

This class has no subclasses.

Blog Entries

Release notes

Some methods using this class:

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.


NSShadowMBS   -   NSSharingServiceItemsMBS


The biggest plugin in space...