0

I am using a Share Extension in my iOS app. I want to be able to accept only text that consists only of numbers. Is it possible to achieve this with NSExtensionActivationRule predicate? I have come across this code below but would like to see if there is anyway to further modify to accept only numbers or a regex defined subset of characters?

<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"
        </string>
    </dict>
    <key>NSExtensionMainStoryboard</key>
    <string>MainInterface</string>
    <key>NSExtensionPointIdentifier</key>
    <string>com.apple.ui-services</string>
</dict>
alionthego
  • 8,508
  • 9
  • 52
  • 125

0 Answers0