---
title: "init(destinationNetwork:prefix:protocol:)"
framework: networkextension
role: symbol
role_heading: Initializer
path: "networkextension/nenetworkrule/init(destinationnetwork:prefix:protocol:)"
---

# init(destinationNetwork:prefix:protocol:)

Creates a rule that matches network traffic destined for a host within a specific network.

## Declaration

```swift
init(destinationNetwork networkEndpoint: NWHostEndpoint, prefix destinationPrefix: Int, protocol: NENetworkRule.Protocol)
```

## Parameters

- `networkEndpoint`: An endpoint instance that matches the port and address or network that the rule matches. This endpoint must contain an address, not a hostname.
- `destinationPrefix`: An integer that in combination with the address in the endpoint specifies the destination network that the rule matches.
- `protocol`: The protocol that the rule matches.

## Discussion

Discussion If the port string of networkEndpoint is 0 or the empty string, the rule matches traffic on any port destined for the given address or network.

## See Also

### Creating a network rule

- [init(destinationHost:protocol:)](networkextension/nenetworkrule/init(destinationhost:protocol:).md)
- [init(remoteNetwork:remotePrefix:localNetwork:localPrefix:protocol:direction:)](networkextension/nenetworkrule/init(remotenetwork:remoteprefix:localnetwork:localprefix:protocol:direction:).md)
