---
title: "init(networkRule:action:)"
framework: networkextension
role: symbol
role_heading: Initializer
path: "networkextension/nefilterrule/init(networkrule:action:)"
---

# init(networkRule:action:)

Creates a new filter rule from a network rule and an action to take when network traffic matches.

## Declaration

```swift
init(networkRule: NENetworkRule, action: NEFilterAction)
```

## Parameters

- `networkRule`: An doc://com.apple.networkextension/documentation/NetworkExtension/NENetworkRule object that defines the network traffic characteristics that this rule matches.
- `action`: The action to take when the network rule matches.
