---
title: NEOnDemandRule
framework: networkextension
role: symbol
role_heading: Class
path: networkextension/neondemandrule
---

# NEOnDemandRule

A base class shared by all VPN On Demand rules.

## Declaration

```swift
class NEOnDemandRule
```

## Overview

Overview Each rule is defined by a single action and a set of optional matching conditions. The action defines how the system should trigger the VPN when the conditions are met, such as connecting automatically for all connections, connecting conditionally, or disconnecting. The optional conditions describe parameters of a network. Some common rules include disconnecting the VPN on a trusted, internal network, and triggering on all other networks. When rules are defined in an array, they are evaluated in order and the action of the first rule to match all conditions is chosen. Instances of the NEOnDemandRule class should be created through one of its subclasses: NEOnDemandRuleConnect, NEOnDemandRuleDisconnect, NEOnDemandRuleEvaluateConnection, or NEOnDemandRuleIgnore.

## Topics

### Accessing match parameters

- [dnsSearchDomainMatch](networkextension/neondemandrule/dnssearchdomainmatch.md)
- [dnsServerAddressMatch](networkextension/neondemandrule/dnsserveraddressmatch.md)
- [interfaceTypeMatch](networkextension/neondemandrule/interfacetypematch.md)
- [NEOnDemandRuleInterfaceType](networkextension/neondemandruleinterfacetype.md)
- [ssidMatch](networkextension/neondemandrule/ssidmatch.md)
- [probeURL](networkextension/neondemandrule/probeurl.md)

### Accessing the rule action

- [action](networkextension/neondemandrule/action.md)
- [NEOnDemandRuleAction](networkextension/neondemandruleaction.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Inherited By

- [NEOnDemandRuleConnect](networkextension/neondemandruleconnect.md)
- [NEOnDemandRuleDisconnect](networkextension/neondemandruledisconnect.md)
- [NEOnDemandRuleEvaluateConnection](networkextension/neondemandruleevaluateconnection.md)
- [NEOnDemandRuleIgnore](networkextension/neondemandruleignore.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Settings

- [NEOnDemandRuleConnect](networkextension/neondemandruleconnect.md)
- [NEOnDemandRuleDisconnect](networkextension/neondemandruledisconnect.md)
- [NEOnDemandRuleIgnore](networkextension/neondemandruleignore.md)
- [NEOnDemandRuleEvaluateConnection](networkextension/neondemandruleevaluateconnection.md)
