---
title: "canPerform(withItems:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssharingservice/canperform(withitems:)"
---

# canPerform(withItems:)

Returns whether the service can share all the specified items.

## Declaration

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

## Parameters

- `items`: The items to share.

## Return Value

Return Value true if the service can share all the items; false otherwise. If items is nil, the method will return true when the service is configured.

## Discussion

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

### Related Documentation

- [perform(withItems:)](appkit/nssharingservice/perform(withitems:).md)

### Querying Service Availability

- [sharingServices(forItems:)](appkit/nssharingservice/sharingservices(foritems:).md)
