<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "XPC",
  "identifier" : "/documentation/XPC/xpc_connection_create_from_endpoint(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "XPC"
    ],
    "preciseIdentifier" : "c:@F@xpc_connection_create_from_endpoint"
  },
  "title" : "xpc_connection_create_from_endpoint(_:)"
}
-->

# xpc_connection_create_from_endpoint(_:)

Creates a new connection from the specified endpoint.

```
func xpc_connection_create_from_endpoint(_ endpoint: xpc_endpoint_t) -> xpc_connection_t
```

## Parameters

`endpoint`

The endpoint from which to create the new connection.

## Return Value

A new peer connection to the listener represented by the given endpoint.

## Discussion

The same responsibilities of setting an event handler and resuming the connection after calling [`xpc_connection_create(_:_:)`](/documentation/XPC/xpc_connection_create(_:_:)) apply to the connection returned by this API. Since the connection yielded by this API is not associated with a name (and therefore is not rediscoverable), this connection will receive [`XPC_ERROR_CONNECTION_INVALID`](/documentation/XPC/XPC_ERROR_CONNECTION_INVALID-swift.var) if the listening side crashes, exits or cancels the listener connection.

---

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)