---
title: "enableCredentialSharingMode(_:)"
framework: threadnetwork
role: symbol
role_heading: Instance Method
path: "threadnetwork/thclient/enablecredentialsharingmode(_:)"
---

# enableCredentialSharingMode(_:)

Triggers Credential Share mode on a nearby eligible Apple Border Router (tvOS(27.0)).

## Declaration

```swift
func enableCredentialSharingMode(_ completion: @escaping @Sendable (String?, (any Error)?) -> Void)
```

```swift
func enableCredentialSharingMode() async throws -> String
```

## Parameters

- `completion`: The completion handler the framework calls when the one-time admin code becomes available.

## Discussion

Discussion This method scans for Thread credential sharing capable Apple Border Routers, selects an eligible device, and requests to generate an ephemeral 9-digit code and start credential sharing mode. When you call this method, an alert appears asking for user permission to access credentials. note: You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declarations: // Completion handler form: func enableCredentialSharingMode(completionHandler: @escaping (String?, Error?) -> Void)

// Async form: func enableCredentialSharingMode() async throws -> String For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously.
