---
title: "checkPreferredNetwork(forActiveOperationalDataset:completion:)"
framework: threadnetwork
role: symbol
role_heading: Instance Method
path: "threadnetwork/thclient/checkpreferrednetwork(foractiveoperationaldataset:completion:)"
---

# checkPreferredNetwork(forActiveOperationalDataset:completion:)

Determines if the essential operating parameters match the preferred network’s parameters.

## Declaration

```swift
func checkPreferredNetwork(forActiveOperationalDataset activeOperationalDataSet: Data, completion: @escaping @Sendable (Bool) -> Void)
```

```swift
func isPreferred(forActiveOperationalDataset activeOperationalDataSet: Data) async -> Bool
```

## Parameters

- `activeOperationalDataSet`: The essential operating parameters to compare against the preferred network’s parameters.
- `completion`: The completion handler that returns the result of the comparison.

## Mentioned in

Managing Thread network credentials Configuring a Border Router

## Discussion

Discussion 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 declaration: func isPreferred(forActiveOperationalDataset activeOperationalDataSet: Data) async -> Bool For information about concurrency and asynchronous code in Swift, see Calling Objective-C APIs Asynchronously. Call the method as follows: func obtainPreferredNetwork(activeOperationalDataset: Data) async -> (NSString?) {     let client = THClient()     var bIsPreferred:Bool?     bIsPreferred = await client.isPreferred(forActiveOperationalDataset: activeOperationalDataset)     let str = ((bIsPreferred == true) ?"true" : "false")     return str as NSString; }

## See Also

### Retrieving Credentials

- [isPreferredNetworkAvailable(completion:)](threadnetwork/thclient/ispreferrednetworkavailable(completion:).md)
- [retrieveCredentials(forBorderAgent:completion:)](threadnetwork/thclient/retrievecredentials(forborderagent:completion:).md)
- [retrieveCredentials(forExtendedPANID:completion:)](threadnetwork/thclient/retrievecredentials(forextendedpanid:completion:).md)
- [retrieveAllCredentials(_:)](threadnetwork/thclient/retrieveallcredentials(_:).md)
- [retrievePreferredCredentials(_:)](threadnetwork/thclient/retrievepreferredcredentials(_:).md)
- [retrieveAllActiveCredentials(_:)](threadnetwork/thclient/retrieveallactivecredentials(_:).md)
