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

# onDemandRules

A list of ordered rules that defines the networks on which the DNS settings will apply.

```
var onDemandRules: [NEOnDemandRule]? { get set }
```

## Discussion

An On Demand rule with the action [`NEOnDemandRuleAction.connect`](/documentation/NetworkExtension/NEOnDemandRuleAction/connect) defines a network on which the DNS settings apply. An On Demand rule with the action [`NEOnDemandRuleAction.disconnect`](/documentation/NetworkExtension/NEOnDemandRuleAction/disconnect) causes DNS settings to not apply. An On Demand rule with the action of [`NEOnDemandRuleAction.evaluateConnection`](/documentation/NetworkExtension/NEOnDemandRuleAction/evaluateConnection) can be used to enable the DNS settings on a network with excluded domains, as specified using a [`NEEvaluateConnectionRuleAction.neverConnect`](/documentation/NetworkExtension/NEEvaluateConnectionRuleAction/neverConnect) rule.

---

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)