---
title: "init(rules:defaultAction:)"
framework: networkextension
role: symbol
role_heading: Initializer
path: "networkextension/nefiltersettings/init(rules:defaultaction:)"
---

# init(rules:defaultAction:)

Creates a new settings instance from an array of rules and a default action.

## Declaration

```swift
init(rules: [NEFilterRule], defaultAction: NEFilterAction)
```

## Parameters

- `rules`: An array containing an ordered list of doc://com.apple.networkextension/documentation/NetworkExtension/NEFilterRule objects. The maximum number of rules that this array can contain is 1000.
- `defaultAction`: The doc://com.apple.networkextension/documentation/NetworkExtension/NEFilterAction to take for flows of network data that don’t match any of the specified rules. The default defaultAction is doc://com.apple.networkextension/documentation/NetworkExtension/NEFilterAction/filterData. If defaultAction is doc://com.apple.networkextension/documentation/NetworkExtension/NEFilterAction/allow or doc://com.apple.networkextension/documentation/NetworkExtension/NEFilterAction/drop, then the rules array must contain at least one doc://com.apple.networkextension/documentation/NetworkExtension/NEFilterRule.

## See Also

### Creating Filter Settings

- [NEFilterRule](networkextension/nefilterrule.md)
