<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XPC",
  "identifier" : "/documentation/XPC/XPCReceivedMessage/reply(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "XPC"
    ],
    "preciseIdentifier" : "s:3XPC18XPCReceivedMessageV5replyyyxSERzlF"
  },
  "title" : "reply(_:)"
}
-->

# reply(_:)

Sends a reply to the originator of the message.

```
func reply<Message>(_ object: Message) where Message : Encodable
```

## Parameters

`object`

A message to send back to the client that sent the original message.

## Discussion

When a listener receives an [`XPCReceivedMessage`](/documentation/XPC/XPCReceivedMessage), the message keeps track of the client that sent it. This function sends the specified reply message back to the originating client.

Don’t call this function more than once on a single message, and don’t call it on a message that wasn’t received from a client. Calling it more than once or sending a reply using a message that wasn’t received triggers an API misuse crash.

---

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)