An NWParameters object contains the parameters necessary to create a network
connection, listener, or browser. NWParameters include any preferences for
network paths (such as required, prohibited, and preferred networks, and local
endpoint requirements); preferences for data transfer and quality of service;
and the protocols to be used for a connection along with any protocol-specific
options.
Members (52)
get · iOS 12.0+
includePeerToPeer
TypeScript
get includePeerToPeer(): boolean
Swift declaration
final var includePeerToPeer: Bool { get set }
Allow the inclusion of peer-to-peer interfaces when
listening or establishing outbound connections. This parameter
will not take effect if a specific interface is required.
This parameter is applicable when advertising a Bonjour service
on a listener, or connecting to a Bonjour service.
set · iOS 12.0+
includePeerToPeer
TypeScript
set includePeerToPeer(value: boolean)
Swift declaration
final var includePeerToPeer: Bool { get set }
Allow the inclusion of peer-to-peer interfaces when
listening or establishing outbound connections. This parameter
will not take effect if a specific interface is required.
This parameter is applicable when advertising a Bonjour service
on a listener, or connecting to a Bonjour service.
get · iOS 26.0+
parameters
TypeScript
get parameters(): NWParameters
Swift declaration
final var parameters: NWParameters { get }
The generated NWParameters.
get · iOS 15.0+
attribution
TypeScript
get attribution(): NWParameters_Attribution
Swift declaration
final var attribution: NWParameters.Attribution { get set }
In order to help differentiate communication with domains requested by the user from those requested by the
developer, attribution may be used. Attribution defaults to .developer. Setting attribution to .user indicates
that the networking performed using these parameters is directed to content specified by the user, not the
developer.
set · iOS 15.0+
attribution
TypeScript
set attribution(value: NWParameters_Attribution)
Swift declaration
final var attribution: NWParameters.Attribution { get set }
In order to help differentiate communication with domains requested by the user from those requested by the
developer, attribution may be used. Attribution defaults to .developer. Setting attribution to .user indicates
that the networking performed using these parameters is directed to content specified by the user, not the
developer.
final class func quicDatagram(alpn: [String]) -> NWParameters
Create a set of parameters for using QUIC datagrams with specified ALPN set
get · iOS 12.0+
serviceClass
TypeScript
get serviceClass(): NWParameters_ServiceClass
Swift declaration
final var serviceClass: NWParameters.ServiceClass { get set }
set · iOS 12.0+
serviceClass
TypeScript
set serviceClass(value: NWParameters_ServiceClass)
Swift declaration
final var serviceClass: NWParameters.ServiceClass { get set }
get · iOS 12.0+
allowFastOpen
TypeScript
get allowFastOpen(): boolean
Swift declaration
final var allowFastOpen: Bool { get set }
Use fast open for an outbound NWConnection, 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 ready state. As a side effect, this may implicitly enable
fast open 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).
set · iOS 12.0+
allowFastOpen
TypeScript
set allowFastOpen(value: boolean)
Swift declaration
final var allowFastOpen: Bool { get set }
Use fast open for an outbound NWConnection, 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 ready state. As a side effect, this may implicitly enable
fast open 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).
get · iOS 12.0+
acceptLocalOnly
TypeScript
get acceptLocalOnly(): boolean
Swift declaration
final var acceptLocalOnly: Bool { get set }
Cause an NWListener to only advertise services on the local link,
and only accept connections from the local link.
set · iOS 12.0+
acceptLocalOnly
TypeScript
set acceptLocalOnly(value: boolean)
Swift declaration
final var acceptLocalOnly: Bool { get set }
Cause an NWListener to only advertise services on the local link,
and only accept connections from the local link.
get · iOS 12.0+
preferNoProxies
TypeScript
get preferNoProxies(): boolean
Swift declaration
final var preferNoProxies: Bool { get set }
If true, a direct connection will be attempted first even if proxies are configured. If the direct connection
fails, connecting through the proxies will still be attempted.
set · iOS 12.0+
preferNoProxies
TypeScript
set preferNoProxies(value: boolean)
Swift declaration
final var preferNoProxies: Bool { get set }
If true, a direct connection will be attempted first even if proxies are configured. If the direct connection
fails, connecting through the proxies will still be attempted.
get · iOS 12.0+
debugDescription
TypeScript
get debugDescription(): string
Swift declaration
final var debugDescription: String { get }
A textual representation of this instance, suitable for debugging.
Calling this property directly is discouraged. Instead, convert an
instance of any type to a string by using the `String(reflecting:)`
initializer. This initializer works with any type, and uses the custom
`debugDescription` property for types that conform to
`CustomDebugStringConvertible`:
struct Point: CustomDebugStringConvertible {
let x: Int, y: Int
var debugDescription: String {
return "(\(x), \(y))"
}
}
let p = Point(x: 21, y: 30)
let s = String(reflecting: p)
print(s)
// Prints "(21, 30)"
The conversion of `p` to a string in the assignment to `s` uses the
`Point` type's `debugDescription` property.
get · iOS 12.0+
requiredInterface
TypeScript
get requiredInterface(): (NWInterface) | null
Swift declaration
final var requiredInterface: NWInterface? { get set }
Require a connection to use a specific interface, or fail if not available
set · iOS 12.0+
requiredInterface
TypeScript
set requiredInterface(value: (NWInterface) | null)
Swift declaration
final var requiredInterface: NWInterface? { get set }
Require a connection to use a specific interface, or fail if not available
final func setPrivacyContext(_ privacyContext: NWParameters.PrivacyContext)
Set a privacy context on the parameters, which will be associated
with connections and listeners. The privacy context allows
using separate caches for different sets of connections, as well as
restricting how connection-specific information is logged and shared
on the network.
get · iOS 16.0+
applicationService
TypeScript
static get applicationService(): NWParameters
Swift declaration
final class var applicationService: NWParameters { get }
Default set of parameters for applicationService
get · iOS 12.0+
expiredDNSBehavior
TypeScript
get expiredDNSBehavior(): NWParameters_ExpiredDNSBehavior
Swift declaration
final var expiredDNSBehavior: NWParameters.ExpiredDNSBehavior { get set }
set · iOS 12.0+
expiredDNSBehavior
TypeScript
set expiredDNSBehavior(value: NWParameters_ExpiredDNSBehavior)
Swift declaration
final var expiredDNSBehavior: NWParameters.ExpiredDNSBehavior { get set }
get · iOS 12.0+
defaultProtocolStack
TypeScript
get defaultProtocolStack(): NWParameters_ProtocolStack
Swift declaration
final var defaultProtocolStack: NWParameters.ProtocolStack { get }
Every NWParameters has a default protocol stack, although it may start out empty.
get · iOS 12.0+
multipathServiceType
TypeScript
get multipathServiceType(): NWParameters_MultipathServiceType
Swift declaration
final var multipathServiceType: NWParameters.MultipathServiceType { get set }
set · iOS 12.0+
multipathServiceType
TypeScript
set multipathServiceType(value: NWParameters_MultipathServiceType)
Swift declaration
final var multipathServiceType: NWParameters.MultipathServiceType { get set }
get · iOS 12.0+
prohibitedInterfaces
TypeScript
get prohibitedInterfaces(): (Array<NWInterface>) | null
Swift declaration
final var prohibitedInterfaces: [NWInterface]? { get set }
Define one or more interfaces that a connection will not be allowed to use
set · iOS 12.0+
prohibitedInterfaces
TypeScript
set prohibitedInterfaces(value: (Array<NWInterface>) | null)
Swift declaration
final var prohibitedInterfaces: [NWInterface]? { get set }
Define one or more interfaces that a connection will not be allowed to use
get · iOS 12.0+
requiredInterfaceType
TypeScript
get requiredInterfaceType(): NWInterface_InterfaceType
Swift declaration
final var requiredInterfaceType: NWInterface.InterfaceType { get set }
Require a connection to use a specific interface type, or fail if not available
set · iOS 12.0+
requiredInterfaceType
TypeScript
set requiredInterfaceType(value: NWInterface_InterfaceType)
Swift declaration
final var requiredInterfaceType: NWInterface.InterfaceType { get set }
Require a connection to use a specific interface type, or fail if not available
get · iOS 12.0+
requiredLocalEndpoint
TypeScript
get requiredLocalEndpoint(): (NWEndpoint) | null
Swift declaration
final var requiredLocalEndpoint: NWEndpoint? { get set }
Force a specific local address to be used. This value is nil by
default, in which case the system selects the most appropriate
local address and selects a local port.
set · iOS 12.0+
requiredLocalEndpoint
TypeScript
set requiredLocalEndpoint(value: (NWEndpoint) | null)
Swift declaration
final var requiredLocalEndpoint: NWEndpoint? { get set }
Force a specific local address to be used. This value is nil by
default, in which case the system selects the most appropriate
local address and selects a local port.
get · iOS 12.0+
prohibitExpensivePaths
TypeScript
get prohibitExpensivePaths(): boolean
Swift declaration
final var prohibitExpensivePaths: Bool { get set }
Disallow connection from using interfaces considered expensive
set · iOS 12.0+
prohibitExpensivePaths
TypeScript
set prohibitExpensivePaths(value: boolean)
Swift declaration
final var prohibitExpensivePaths: Bool { get set }
Disallow connection from using interfaces considered expensive
get · iOS 12.0+
allowLocalEndpointReuse
TypeScript
get allowLocalEndpointReuse(): boolean
Swift declaration
final var allowLocalEndpointReuse: Bool { get set }
Allow multiple connections to use the same local address and port
(SO_REUSEADDR and SO_REUSEPORT).
set · iOS 12.0+
allowLocalEndpointReuse
TypeScript
set allowLocalEndpointReuse(value: boolean)
Swift declaration
final var allowLocalEndpointReuse: Bool { get set }
Allow multiple connections to use the same local address and port
(SO_REUSEADDR and SO_REUSEPORT).
get · iOS 13.0+
prohibitConstrainedPaths
TypeScript
get prohibitConstrainedPaths(): boolean
Swift declaration
final var prohibitConstrainedPaths: Bool { get set }
Disallow connection from using interfaces considered constrained
by the system
set · iOS 13.0+
prohibitConstrainedPaths
TypeScript
set prohibitConstrainedPaths(value: boolean)
Swift declaration
final var prohibitConstrainedPaths: Bool { get set }
Disallow connection from using interfaces considered constrained
by the system
get · iOS 12.0+
prohibitedInterfaceTypes
TypeScript
get prohibitedInterfaceTypes(): (Array<NWInterface_InterfaceType>) | null
Swift declaration
final var prohibitedInterfaceTypes: [NWInterface.InterfaceType]? { get set }
Define one or more interface types that a connection will not be allowed to use
set · iOS 12.0+
prohibitedInterfaceTypes
TypeScript
set prohibitedInterfaceTypes(value: (Array<NWInterface_InterfaceType>) | null)
Swift declaration
final var prohibitedInterfaceTypes: [NWInterface.InterfaceType]? { get set }
Define one or more interface types that a connection will not be allowed to use
get · iOS 16.0+
requiresDNSSECValidation
TypeScript
get requiresDNSSECValidation(): boolean
Swift declaration
final var requiresDNSSECValidation: Bool { get set }
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:
`NWEndpoint.hostPort(host:port:)`
`NWEndpoint.url(_:)`
1. If this property is not set or set to false on the parameters, DNSSEC
validation will not be required.
2. If this property is set to true and no additional DNSSEC
configuration is set on the parameters, the default behavior will be
followed: Only DNSSEC secure and DNSSEC insecure resolved result will be
used to establish a connection.
3. If this property is set to true and additional DNSSEC configuration
is set on the parameters, the behavior specified by that configuration
will be followed.
set · iOS 16.0+
requiresDNSSECValidation
TypeScript
set requiresDNSSECValidation(value: boolean)
Swift declaration
final var requiresDNSSECValidation: Bool { get set }
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:
`NWEndpoint.hostPort(host:port:)`
`NWEndpoint.url(_:)`
1. If this property is not set or set to false on the parameters, DNSSEC
validation will not be required.
2. If this property is set to true and no additional DNSSEC
configuration is set on the parameters, the default behavior will be
followed: Only DNSSEC secure and DNSSEC insecure resolved result will be
used to establish a connection.
3. If this property is set to true and additional DNSSEC configuration
is set on the parameters, the behavior specified by that configuration
will be followed.
get · iOS 26.0+
allowUltraConstrainedPaths
TypeScript
get allowUltraConstrainedPaths(): boolean
Swift declaration
final var allowUltraConstrainedPaths: Bool { get set }
Allow connection to use interfaces considered ultra-constrained
by the system
set · iOS 26.0+
allowUltraConstrainedPaths
TypeScript
set allowUltraConstrainedPaths(value: boolean)
Swift declaration
final var allowUltraConstrainedPaths: Bool { get set }
Allow connection to use interfaces considered ultra-constrained
by the system
get · iOS 12.0+
tcp
TypeScript
static get tcp(): NWParameters
Swift declaration
final class var tcp: NWParameters { get }
Default set of parameters for TCP
This is equivalent to calling init(tls:nil, tcp:NWProtocolTCP.Options())
Creates a parameters object that is configured for TLS and TCP. The caller can use
the default configuration for TLS and TCP, or set specific options for each protocol,
or disable TLS.
- Parameter tls: TLS options or nil for no TLS
- Parameter tcp: TCP options. Defaults to NWProtocolTCP.Options() with no options overridden.
- Returns: NWParameters object that can be used for creating a connection or listener
get · iOS 12.0+
tls
TypeScript
static get tls(): NWParameters
Swift declaration
final class var tls: NWParameters { get }
Default set of parameters for TLS over TCP
This is equivalent to calling init(tls:NWProtocolTLS.Options(), tcp:NWProtocolTCP.Options())
get · iOS 12.0+
udp
TypeScript
static get udp(): NWParameters
Swift declaration
final class var udp: NWParameters { get }
Default set of parameters for UDP
This is equivalent to calling init(dtls:nil, udp:NWProtocolUDP.Options())
Creates a parameters object that is configured for DTLS and UDP. The caller can use
the default configuration for DTLS and UDP, or set specific options for each protocol,
or disable TLS.
- Parameter dtls: DTLS options or nil for no DTLS
- Parameter udp: UDP options. Defaults to NWProtocolUDP.Options() with no options overridden.
- Returns: NWParameters object that can be used for create a connection or listener
get · iOS 12.0+
dtls
TypeScript
static get dtls(): NWParameters
Swift declaration
final class var dtls: NWParameters { get }
Default set of parameters for DTLS over UDP
This is equivalent to calling init(dtls:NWProtocolTLS.Options(), udp:NWProtocolUDP.Options())
static · iOS 15.0+
quic
TypeScript
static quic(alpn: Array<string>): NWParameters
Swift declaration
final class func quic(alpn: [String]) -> NWParameters
Default set of parameters for QUIC with specified ALPN set
This is equivalent to calling init(quic:NWProtocolQUIC.Options(alpn:alpn))
Creates a parameters object that is configured for using QUIC. The caller can use
the default configuration for QUIC, or set specific options.
- Parameter quic: QUIC options.
- Returns: NWParameters object that can be used for create a connection or listener
init · iOS 12.0+
init
TypeScript
static init(): NWParameters
Swift declaration
init()
Creates a generic NWParameters object. Note that in order to use parameters
with a NWConnection or a NetworkListener, the parameters must have protocols
added into the defaultProtocolStack. Clients using standard protocol
configurations should use init(tls:tcp:) or init(dtls:udp:).