<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "NetworkExtension",
  "identifier" : "/documentation/NetworkExtension/NERelayManager",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Network Extension"
    ],
    "preciseIdentifier" : "c:objc(cs)NERelayManager"
  },
  "title" : "NERelayManager"
}
-->

# NERelayManager

An object you use to create and manage a network relay configuration.

```
class NERelayManager
```

## Overview

When your app starts up, access the shared instance of the relay manager, and load existing settings from the preferences using [`loadFromPreferences(completionHandler:)`](/documentation/NetworkExtension/NERelayManager/loadFromPreferences(completionHandler:)). You can define your relay server configuration, and persist it by calling [`saveToPreferences(completionHandler:)`](/documentation/NetworkExtension/NERelayManager/saveToPreferences(completionHandler:)).

## Topics

### Managing relay configurations

[`+  sharedManager`](/documentation/NetworkExtension/NERelayManager/shared())

Access the single instance of a network relay manager.

[`-  loadFromPreferencesWithCompletionHandler:`](/documentation/NetworkExtension/NERelayManager/loadFromPreferences(completionHandler:))

Load your relay configuration from the system networking preferences.

[`-  saveToPreferencesWithCompletionHandler:`](/documentation/NetworkExtension/NERelayManager/saveToPreferences(completionHandler:))

Save your relay configuration to the system networking preferences.

[`-  removeFromPreferencesWithCompletionHandler:`](/documentation/NetworkExtension/NERelayManager/removeFromPreferences(completionHandler:))

Remove your relay configuration from the system networking preferences.

### Accessing relay configuration properties

[`enabled`](/documentation/NetworkExtension/NERelayManager/isEnabled)

A Boolean used to toggle the enabled state of the relay configuration.

[`relays`](/documentation/NetworkExtension/NERelayManager/relays)

An array of one or two relay server configurations. If multiple relays are configured, application traffic routes through both of them in the order they appear in the array.

[`matchDomains`](/documentation/NetworkExtension/NERelayManager/matchDomains)

A list of domain strings used to determine which connections will use the relay configuration contained in this object.

[`excludedDomains`](/documentation/NetworkExtension/NERelayManager/excludedDomains)

A list of domain strings used to determine which connections won’t use the relay configuration contained in this object.

[`localizedDescription`](/documentation/NetworkExtension/NERelayManager/localizedDescription)

A string that contains the display name of the relay configuration.

[`onDemandRules`](/documentation/NetworkExtension/NERelayManager/onDemandRules)

An array of rules you use to determine which networks the relay uses.

[`NEOnDemandRule`](/documentation/NetworkExtension/NEOnDemandRule)

A base class shared by all VPN On Demand rules.

### Loading previously-used managers

[`+  loadAllManagersFromPreferencesWithCompletionHandler:`](/documentation/NetworkExtension/NERelayManager/loadAllManagersFromPreferences(completionHandler:))

Asynchronously reads all the relay configurations previously created and saved by the calling app.

### Handling errors

[`NERelayErrorDomain`](/documentation/NetworkExtension/NERelayErrorDomain)

The domain for errors resulting from calls to the relay manager.

[`NERelayManagerError`](/documentation/NetworkExtension/NERelayManagerError)

Error codes specific to relay managers.

## Relationships

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)