<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XPC",
  "identifier" : "/documentation/XPC/XPCListener",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "XPC"
    ],
    "preciseIdentifier" : "s:3XPC11XPCListenerC"
  },
  "title" : "XPCListener"
}
-->

# XPCListener

A type that performs tasks for clients across process boundaries.

```
class XPCListener
```

## Overview

To implement an XPC service, create a listener and respond to incoming session requests.

## Topics

### Creating a listener

[`init(service:targetQueue:options:incomingSessionHandler:)`](/documentation/XPC/XPCListener/init(service:targetQueue:options:incomingSessionHandler:))

Creates the server side of an XPC service using the specified service name.

[`InitializationOptions`](/documentation/XPC/XPCListener/InitializationOptions)

Options that control the listener’s configuration, such as if it’s inactive at creation.

[`IncomingSessionRequest`](/documentation/XPC/XPCListener/IncomingSessionRequest)

A session request from a client that you accept or reject.

### Managing the life cycle

[`activate()`](/documentation/XPC/XPCListener/activate())

Activates an inactive listener.

[`cancel()`](/documentation/XPC/XPCListener/cancel())

Cancels a listener.

### Handling incoming messages

[`XPCPeerHandler`](/documentation/XPC/XPCPeerHandler)

A type that handles incoming messages from a client and session cancellation.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Copyable`](/documentation/Swift/Copyable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Escapable`](/documentation/Swift/Escapable)

---

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)