<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSharingService/canPerform(withItems:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSharingService(im)canPerformWithItems:"
  },
  "title" : "canPerform(withItems:)"
}
-->

# canPerform(withItems:)

Returns whether the service can share all the specified items.

```
func canPerform(withItems items: [Any]?) -> Bool
```

## Parameters

`items`

The items to share.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the service can share all the items; <doc://com.apple.documentation/documentation/Swift/false> otherwise. If `items` is `nil`, the method will return <doc://com.apple.documentation/documentation/Swift/true> when the service is configured.

## Discussion

This method can be used to validate a custom user interface such as a dedicated Twitter button.  Therefore you could call it once at launch time with `nil` items to check whether to display the button or not, and then with real items to enable and disable the button depending on the context or selection.

## See Also

[`perform(withItems:)`](/documentation/AppKit/NSSharingService/perform(withItems:))

Manually performs the service on the provided items.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)