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

# NEEvaluateConnectionRule

`NEEvaluateConnectionRule` associates properties of network connections with an action.

```
class NEEvaluateConnectionRule
```

## Topics

### Initializing a Rule

[`-  initWithMatchDomains:andAction:`](/documentation/NetworkExtension/NEEvaluateConnectionRule/init(matchDomains:andAction:))

Initialize an `NEEvaluateConnectionRule` instance with a list of destination host domains and an action.

### Accessing Rule Match Properties

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

An array of domains used to match the destination hostname of connections. If the destination hostname of a connection matches any of the domains in the array, then the connection matches the rule. Each domain is matched against the destination hostname using suffix matching, and each label in the domain must match an entire label in the hostname. For example, the domain `example.com` will match the hostname `www.example.com` but not `www.anotherexample.com`.

[`useDNSServers`](/documentation/NetworkExtension/NEEvaluateConnectionRule/useDNSServers)

If the rule matches the connection being established and the action is `NEEvaluateConnectionRuleActionConnectIfNeeded`, the DNS servers specified in this array are used to resolve the destination hostname of the connection while evaluating connectivity to the destination of the connection. If the resolution fails for any reason, the VPN is started.

[`probeURL`](/documentation/NetworkExtension/NEEvaluateConnectionRule/probeURL)

An HTTP or HTTPS URL. If the rule matches the connection being established and the action is `NEEvaluateConnectionRuleActionConnectIfNeeded` and a request sent to this URL results in a response with an HTTP response code other than 200, then the VPN is started.

### Accessing the Rule Action

[`action`](/documentation/NetworkExtension/NEEvaluateConnectionRule/action)

The action to take if the properties of the network connection being established match the rule.

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

## Relationships

### Conforms To

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

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

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

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

[`NSCopying`](/documentation/Foundation/NSCopying)

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

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

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

[`NSCoding`](/documentation/Foundation/NSCoding)

### 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)