<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPerformService(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:@F@NSPerformService"
  },
  "title" : "NSPerformService(_:_:)"
}
-->

# NSPerformService(_:_:)

Programmatically invokes a Services menu service.

```
func NSPerformService(_ itemName: String, _ pboard: NSPasteboard?) -> Bool
```

## Parameters

`itemName`

Specifies a Services menu item, in any language. If the requested service is from a submenu of the Services menu, the value must contain a slash (for example, “Mail/Selection”).

`pboard`

The pasteboard containing the data required by the service. This data must be present for the service to succeed. On output, this pasteboard contains the data returned by the service provider.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the service was successfully performed or <doc://com.apple.documentation/documentation/Swift/false> if it was not.

## Discussion

Use this function to programmatically invoke a service found in the application’s Services menu.

---

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)