Share extension activation rule for selected text on macOS

I have a share extension in my app, that shall allow users to send CSV files, custom app files, and selected text to my app via the share sheet for importing that data.

So, the share extension should activate when the user has selected either:

  • CSV or plain text files
  • Custom UTI app files
  • Text selected in other apps

The supported file types have been defined in as a predicate query according to the example in the docs

This works all fine on iOS, and the file sharing also works on the Mac.

However, on macOS, my app is not shown as a target in the share sheet when the user selects text in other apps and tries to share that text via the context menu. Does macOS need a different configuration to enable a share extension for selected text?

This is how my Info.plist of the Mac share extension looks like:

...
<plist version="1.0">
<dict>
	<key>NSExtension</key>
	<dict>
		<key>NSExtensionAttributes</key>
		<dict>
			<key>NSExtensionActivationRule</key>
			<string>SUBQUERY (
    extensionItems,
    $extensionItem,
    SUBQUERY (
        $extensionItem.attachments,
        $attachment,
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text" ||
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "com.myCompany.myApp.customFormat"  ||
        ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.delimited-values-text"
    ).@count == $extensionItem.attachments.@count
).@count &gt;= 1</string>
	</dict>
	...
</dict>
</plist>

I know there is a NSExtensionActivationSupportsText but it seems this cannot be combined with a subquery rule.

Is there a way to explicitly enable text activation within the subquery rule?

Share extension activation rule for selected text on macOS
 
 
Q