<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.1.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ExtensionFoundation",
  "identifier" : "/documentation/ExtensionFoundation/AppExtensionConfiguration/accept(connection:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "ExtensionFoundation"
    ],
    "preciseIdentifier" : "s:19ExtensionFoundation03AppA13ConfigurationP6accept10connectionSbSo15NSXPCConnectionC_tF"
  },
  "title" : "accept(connection:)"
}
-->

# accept(connection:)

Returns a Boolean value that indicates whether you accept an incoming connection
request from the host app.

```
nonisolated func accept(connection: NSXPCConnection) -> Bool
```

## Parameters

`connection`

A connection object you can use to communicate with the host app.

## Return Value

`true` if you accept the connection to the host app, or `false` if you don’t.

## Discussion

Implement this method in your custom type and use it to establish communication between your
app extension and the host app that made the request. To accept a connection request, set
the connection’s <doc://com.apple.documentation/documentation/Foundation/NSXPCConnection/exportedObject>
property to an object in your app extension that implements a protocol or type from the host’s
SDK. Similarly, put the type information in the
<doc://com.apple.documentation/documentation/Foundation/NSXPCConnection/exportedInterface>
property. You can also retrieve other relevant properties of the connection object, such as
the remote connection details, and use them to set up your app extension. When you’re ready
to start communicating with the host, call the connection’s
<doc://com.apple.documentation/documentation/Foundation/NSXPCConnection/resume()> method and
then return `true` from this method.

---

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)