One Logo Pool Ball
Network · IOS API REFERENCE

NWParametersProvider

protocol · iOS 26.0+ · SDK 27.1

protocol NWParametersProvider

Types that conform to the NWParametersProvider protocol can be used to generate an NWParameters.

Members (18)

method · iOS 26.0+

serviceClass

Swift declaration
func serviceClass(_ serviceClass: NWParameters.ServiceClass) -> Self

Set the data service class to use for connections. - Parameter serviceClass: The service class to use.

method · iOS 26.0+

localEndpoint

Swift declaration
func localEndpoint(_ endpoint: NWEndpoint?) -> Self

Specify a specific endpoint to use as the local endpoint. For connections, this will be used to initiate traffic; for listeners, this will be used for receiving incoming connections. - Parameter endpoint: The local endpoint to require, or `nil` if none.

method · iOS 26.0+

fastOpenAllowed

Swift declaration
func fastOpenAllowed(_ allowed: Bool) -> Self

Allow fast open to be used on a connection. Use fast open for an outbound connection, which may be done at any protocol level. Use of fast open requires that the caller send idempotent data on the connection before the connection may move into the ready state. > Warning: This may have security implications for application data. In particular, TLS early data is replayable by a network attacker. You must account for this when sending data before the handshake is confirmed. See RFC 8446 for more information. You MUST NOT enable fast open without a specific application profile that defines its use. As a side effect, this may implicitly enable fast open or early data for protocols in the stack, even if they did not have fast open explicitly enabled on them (such as the option to enable TCP Fast Open). - Parameter allowed: True if fast open should be used, false otherwise.

method · iOS 26.0+

requiredInterface

Swift declaration
func requiredInterface(_ interface: NWInterface) -> Self

Require an interface when connecting, listening, and browsing. - Parameter interface: The interface to require.

method · iOS 26.0+

expiredDNSBehavior

Swift declaration
func expiredDNSBehavior(_ behavior: NWParameters.ExpiredDNSBehavior) -> Self

Allow or prohibit the use of expired DNS answers during connection establishment. If allowed, a DNS answer that was previously returned may be re-used for new connections even after the answers are considered expired. A query for fresh answers will be sent in parallel, and the fresh answers will be used as alternate addresses in case the expired answers do not result in successful connections. By default, this value is `.systemDefault`, which allows the system to determine if it is appropriate to use expired answers. - Parameter behavior: The expired DNS behavior to use.

method · iOS 26.0+

noProxiesPreferred

Swift declaration
func noProxiesPreferred(_ noProxies: Bool) -> Self

Prefer not using proxies when making connections. Attempt connections without using proxies, only using any configured proxies if the connection cannot otherwise be completed. - Parameter noProxies: True if connections should not use proxies, false otherwise.

method · iOS 26.0+

peerToPeerIncluded

Swift declaration
func peerToPeerIncluded(_ included: Bool) -> Self

Include peer-to-peer interfaces when connecting, listening, and browsing. > Important: Connections, Listeners, and Browsers using peer-to-peer interfaces can consume significantly more power and should not be kept running for longer than necessary. > > Peer-to-peer link technologies can be power-intensive. If a connection or listener with this flag enabled remains idle for an extended period, the system may return a `kDNSServiceErr_AWDLTimeout` error, transitioning it to a failed state that yields no further results. Any retry mechanism should implement exponential backoff or similar rate-limiting to avoid prolonged power drain. This will not take effect if a specific interface is required. Applicable when advertising a Bonjour service on a listener, or connecting to a Bonjour service. - Parameter included: True if peer-to-peer interfaces should be included, false otherwise.

method · iOS 26.0+

multipathServiceType

Swift declaration
func multipathServiceType(_ type: NWParameters.MultipathServiceType) -> Self

Set the multipath service to use for connections. - Parameter type: The multipath service type to use.

method · iOS 26.0+

prohibitedInterfaces

Swift declaration
func prohibitedInterfaces(_ interfaces: [NWInterface]) -> Self

Prohibit certain interfaces from being used to connect, listen, and browse. - Parameter interfaces: An array of interfaces to prohibit.

method · iOS 26.0+

requiredInterfaceType

Swift declaration
func requiredInterfaceType(_ type: NWInterface.InterfaceType) -> Self

Require an interface type when connecting, listening, and browsing. - Parameter type: The interface type to require.

method · iOS 26.0+

dnssecValidationRequired

Swift declaration
func dnssecValidationRequired(_ required: Bool) -> Self

Require DNSSEC validation when resolving an endpoint before making a connection. DNSSEC validation only takes effect if making a connection to an endpoint that requires domain name resolution, such as a host or URL endpoint. - If this is not set or is set to `false`, DNSSEC validation will not be required. - If this is set to `true` and no additional DNSSEC configuration is set, the default behavior will be followed: Only DNSSEC secure and DNSSEC insecure resolved results will be used to establish a connection. - If this is set to `true` and additional DNSSEC configuration is set on the parameters, the behavior specified by that configuration will be used. - Parameter required: True if DNSSEC validation is required, false otherwise.

method · iOS 26.0+

expensivePathsProhibited

Swift declaration
func expensivePathsProhibited(_ prohibited: Bool) -> Self

Prohibit using expensive paths. Prohibit connections and listeners from using a network interface that is considered expensive by the system, for example some cellular interfaces. - Parameter prohibited: True if expensive paths are prohibited, false otherwise.

method · iOS 26.0+

prohibitedInterfaceTypes

Swift declaration
func prohibitedInterfaceTypes(_ types: [NWInterface.InterfaceType]) -> Self

Prohibit certain interface types from being used to connect, listen, and browse. - Parameter types: An array of interface types to prohibit.

method · iOS 26.0+

localEndpointReuseAllowed

Swift declaration
func localEndpointReuseAllowed(_ allowed: Bool) -> Self

Allow local endpoint reuse. Allow multiple connections to use the same local address and port (`SO_REUSEADDR` and `SO_REUSEPORT`). - Parameter allowed: True if allowed, false otherwise.

method · iOS 26.0+

constrainedPathsProhibited

Swift declaration
func constrainedPathsProhibited(_ prohibited: Bool) -> Self

Prohibit using constrained paths. Prohibit connections and listeners from using a network interface that is considered constrained by the system, for example an interface in Low Data Mode. - Parameter prohibited: True if constrained paths are prohibited, false otherwise.

method · iOS 26.0+

ultraConstrainedPathsAllowed

Swift declaration
func ultraConstrainedPathsAllowed(_ val: Bool) -> Self

Allow connection to use interfaces considered to be ultra-constrained by the system.

method · iOS 26.0+

localOnly

Swift declaration
func localOnly(_ local: Bool) -> Self

Limit inbound connections to peers attached to the local link. Listeners will only advertise services on the local link and will only accept connections from the local link. - Parameter local: True if limited to local peers, false otherwise.

method · iOS 26.0+

localPort

Swift declaration
func localPort(_ port: NWEndpoint.Port) -> Self

Specify a specific port to use as the local endpoint, letting the system select the address. For connections, this will be used to initiate traffic; for listeners, this will be used for receiving incoming connections. - Parameter port: The local port to require. Force a specific local port to be used.

Skipped declarations

No declarations were skipped in this snapshot.

All Network types →