<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ExtensionFoundation",
  "identifier" : "/documentation/ExtensionFoundation/ConnectionHandler/init(onSessionRequest:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "ExtensionFoundation"
    ],
    "preciseIdentifier" : "s:19ExtensionFoundation17ConnectionHandlerV16onSessionRequestAC3XPC11XPCListenerC08IncomingfG0C8DecisionVAIc_tcfc"
  },
  "title" : "init(onSessionRequest:)"
}
-->

# init(onSessionRequest:)

Initializes the connection handler with a closure that accepts an XPC session.

```
@MainActor @preconcurrency init(onSessionRequest requestHandler: @escaping @Sendable (XPCListener.IncomingSessionRequest) -> XPCListener.IncomingSessionRequest.Decision)
```

## Discussion

Use this initializer if your app extension communicates with the host app using types from
the <doc://com.apple.documentation/documentation/XPC> framework.

---

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)