Network is a transport networking API for establishing TCP, UDP, and TLS connections across iOS, macOS, tvOS, watchOS, and visionOS. You configure connections through nw_parameters and nw_protocol_options, connect to an nw_endpoint, and drive an nw_connection through its connection states to send and receive framed messages with content contexts. The framework also supports Bonjour service discovery with nw_browser and nw_advertise_descriptor, and reports network reachability through nw_path and its path status, so you can adapt to changing interfaces and link quality. Establishment and resolution reports such as nw_establishment_report and nw_resolution_report give you visibility into how a connection was made.
Connections 6
Bidirectional transport sessions you establish to send and receive framed messages.
- ClNWConnectioniOS 12.0+An NWConnection is an object that represents a bi-directional data pipe between
- ClNetworkConnectioniOS 26.0+Connect to an endpoint on the network to send and receive data.
- PrConnectableiOS 26.0+Describes types that can be used to make NetworkConnections.
- PrConnectionStorageiOS 26.0+Types that conform to ConnectionStorage can be used as additional storage within
- Stnw_connection_state_t@typedef nw_connection_state_t
- PrOS_nw_connectionThe underlying object type backing a network connection.
Connection Groups and Channels 11
Grouped and link-layer transports for multicast, multiplexed, and Ethernet communication.
- ClNWConnectionGroupiOS 14.0+An `NWConnectionGroup` is an object that represents an active session with multiple entities
- ClNWMulticastGroupiOS 14.0+A `NWMulticastGroup` is a specific type of `NWGroupDescriptor` that can be used to create
- ClNWMultiplexGroupiOS 15.0+An `NWMultiplexGroup` is a specific type of `NWGroupDescriptor` that can be used to create
- ClNWEthernetChannelAn Ethernet channel is an object that represents a bi-directional data channel to send
- ClNetworkChanneliOS 26.0+A base class supporting sending and recieving data through an arbitrary network channel.
- PrNWGroupDescriptoriOS 14.0+An `NWGroupDescriptor` defines a set of endpoints that can be communicated with
- Stnw_connection_group_state_t@typedef nw_connection_group_state_t
- Stnw_ethernet_channel_state_tmacOS 10.15+@typedef nw_ethernet_channel_state_t
- PrOS_nw_connection_groupThe underlying object type backing a connection group.
- PrOS_nw_group_descriptorThe underlying object type that describes a connection group.
- PrOS_nw_ethernet_channelThe underlying object type backing an Ethernet channel.
Listeners 6
Server-side objects that accept incoming connections and advertise services.
- ClNWListeneriOS 12.0+An NWListener is an object that is able to receive incoming NWConnection
- ClNetworkListeneriOS 26.0+Listen for incoming network connections.
- PrListenerProvideriOS 26.0+Extensible support for configuring advertise descriptors to define the service a listener should advertise.
- StBonjourListenerProvideriOS 26.0+Advertise a Bonjour service.
- Stnw_listener_state_t@typedef nw_listener_state_t
- PrOS_nw_listenerThe underlying object type backing a network listener.
Endpoints and Addresses 7
Values that identify the hosts, ports, and addresses a connection communicates with.
- EnNWEndpointiOS 12.0+A local or remote endpoint identified by host, address, or service.
- PrIPAddressiOS 12.0+An IP address
- StIPv4AddressiOS 12.0+IPv4Address
- StIPv6AddressiOS 12.0+IPv6Address
- Stnw_endpoint_type_t@typedef nw_endpoint_type_t
- StUnexpectedEndpointTypeiOS 26.0+An error generated when an unexpected endpoint type is supplied.
- PrOS_nw_endpointThe underlying object type that represents a network endpoint.
Parameters and Protocol Stacks 20
Configuration that defines the protocol stack, options, and policies used to establish connections.
- ClNWParametersiOS 12.0+An NWParameters object contains the parameters necessary to create a network
- StNWParametersBuilderiOS 26.0+An opaque class that is responsible for creating and configuring NWParameters based on
- PrNWParametersProvideriOS 26.0+Types that conform to the NWParametersProvider protocol can be used to
- PrNetworkProtocolOptionsiOS 26.0+A protocol describing configurable options for a network protocol.
- ClNWProtocoliOS 12.0+NWProtocol is an abstract superclass to which protocol implementations conform.
- ClNWProtocolDefinitioniOS 12.0+NWProtocolDefinition is an abstract superclass that represents the identifier of a
- ClNWProtocolOptionsiOS 12.0+NWProtocolOptions is an abstract superclass that represents a configuration options
- ClNWProtocolMetadataiOS 12.0+NWProtocolMetadata is an abstract superclass. An instance of metadata holds a set of
- PrNetworkMetadataProtocoliOS 26.0+Types that conform to NetworkProtocolOptions can be used
- StDefaultProtocolStorageiOS 26.0+Storage that holds the default protocol configuration for a connection.
- Stnw_service_class_t@typedef nw_service_class_t
- Stnw_multipath_service_t@typedef nw_multipath_service_t
- Stnw_multipath_version_t@typedef nw_multipath_version_t
- Stnw_parameters_expired_dns_behavior_t@typedef nw_parameters_expired_dns_behavior_t
- Ennw_parameters_attribution_t@typedef nw_parameters_attribution_t
- PrOS_nw_parametersThe underlying object type that holds connection parameters.
- PrOS_nw_protocol_definitionThe underlying object type that identifies a protocol in a stack.
- PrOS_nw_protocol_optionsThe underlying object type that holds configurable protocol options.
- PrOS_nw_protocol_metadataThe underlying object type that carries per-protocol message metadata.
- PrOS_nw_protocol_stackThe underlying object type that represents an ordered stack of protocols.
Transport and Security Protocols 29
Built-in protocol implementations for TCP, UDP, IP, TLS, QUIC, and WebSocket.
- ClNWProtocolTCPiOS 12.0+A protocol definition and options for TCP transport connections.
- ClNWProtocolUDPiOS 12.0+A protocol definition and options for UDP transport connections.
- ClNWProtocolIPiOS 12.0+A protocol definition and options for the Internet Protocol layer.
- ClNWProtocolTLSiOS 12.0+A protocol definition and options for TLS-secured connections.
- ClNWProtocolQUICiOS 15.0+A protocol definition and options for QUIC transport connections.
- ClNWProtocolWebSocketiOS 13.0+NWProtocolWebSocket is the default system implementation of the WebSocket Protocol.
- StTCPiOS 26.0+The system definition of the Transmission Control Protocol (TCP).
- StUDPiOS 26.0+The system definition of the User Datagram Protocol (UDP).
- StIPiOS 26.0+The system definition of the Internet Protocol (IP).
- StTLSiOS 26.0+The system definition of the Transport Layer Security (TLS) protocol.
- StQUICiOS 26.0+The system definition of the QUIC protocol.
- StQUICStreamiOS 26.0+A QUIC stream that runs over a QUIC connection.
- StQUICDatagramiOS 26.0+Send and receive unreliable datagrams over QUIC via RFC 9221
- StWebSocketiOS 26.0+The system definition of the WebSocket protocol.
- PrStreamProtocoliOS 26.0+Types that conform to the StreamProtocol protocol expose methods for
- PrDatagramProtocoliOS 26.0+Types that conform to DatagramProtocol send and receive messages
- PrMessageProtocoliOS 26.0+Types that conform to MessageProtocol send and receive messages.
- PrOneToOneProtocoliOS 26.0+Types that conform to OneToOneProtocol are allowed to be the top protocol
- PrMultiplexProtocoliOS 26.0+Types that conform to MultiplexProtocol are allowed to be the top protocol
- Stnw_ip_version_t@typedef nw_ip_version_t
- Stnw_ip_local_address_preference_t@typedef nw_ip_local_address_preference_t
- Stnw_ip_ecn_flag_t@typedef nw_ip_ecn_flag_t
- Stnw_quic_stream_type_t@typedef nw_quic_stream_type_t
- Stnw_ws_opcode_t@typedef nw_ws_opcode_t
- Stnw_ws_close_code_t@typedef nw_ws_close_code_t
- Stnw_ws_version_t@typedef nw_ws_version_t
- Stnw_ws_response_status_t@typedef nw_ws_response_status_t
- PrOS_nw_ws_requestThe underlying object type that represents a WebSocket handshake request.
- PrOS_nw_ws_responseThe underlying object type that represents a WebSocket handshake response.
Custom Protocol Framing 7
Types for defining custom message framers that parse and produce application protocol data.
- ClNWProtocolFrameriOS 13.0+An NWProtocolFramer defines a protocol in a connection's protocol
- PrNWProtocolFramerImplementationiOS 13.0+NWProtocolFramerImplementation is a Swift protocol that defines an
- StFrameriOS 26.0+An instance of a Framer protocol to load into a protocol stack.
- PrFramerProtocoliOS 26.0+Framer protocols allow custom framing and serialization of messages on
- StTLViOS 26.0+A Type-Length-Value (TLV) framing protocol.
- Stnw_framer_start_result_tConstants that indicate how a custom framer should begin processing.
- PrOS_nw_framerThe underlying object type that backs a custom protocol framer instance.
Service Discovery 13
Bonjour browsing and advertising for discovering and publishing network services.
- ClNWBrowseriOS 13.0+An NWBrowser discovers and tracks changes of advertised services in a local
- ClNetworkBrowseriOS 26.0+Discover advertised services and devices on the network.
- PrBrowserProvideriOS 26.0+BrowserProviders can be used when creating NetworkBrowsers.
- StBonjouriOS 26.0+A browser that discovers Bonjour services.
- StNWTXTRecordiOS 13.0+An NWTXTRecord is used to provide additional information about a service
- StTXTRecordDecoderiOS 18.0+A decoder that reads values from a Bonjour TXT record.
- Stnw_browser_state_t@typedef nw_browser_state_t
- PrOS_nw_browserThe underlying object type backing a network service browser.
- PrOS_nw_browse_descriptorThe underlying object type that describes a service to browse for.
- PrOS_nw_browse_resultThe underlying object type that represents a discovered service.
- PrOS_nw_advertise_descriptorThe underlying object type that describes a service to advertise.
- PrOS_nw_txt_recordThe underlying object type backing a Bonjour TXT record.
- Stnw_txt_record_find_key_t@typedef nw_txt_record_find_key_t
Path Monitoring and Interfaces 11
Reporting on network reachability, available interfaces, and link quality.
- ClNWPathMonitoriOS 12.0+The NWPathMonitor allows the caller to fetch the current global path (or
- StNWPathiOS 12.0+An NWPath object represents a snapshot of network path state. This state
- StNWInterfaceiOS 12.0+An NWInterface object represents an instance of a network interface of a specific
- Stnw_path_status_t@typedef nw_path_status_t
- Stnw_path_unsatisfied_reason_t@typedef nw_path_unsatisfied_reason_t
- Stnw_link_quality_t@typedef nw_link_quality_t
- Stnw_interface_type_t@typedef nw_interface_type_t
- Stnw_interface_radio_type_t@typedef nw_interface_radio_type_t
- PrOS_nw_pathThe underlying object type that represents a network path.
- PrOS_nw_path_monitorThe underlying object type backing a network path monitor.
- PrOS_nw_interfaceThe underlying object type that represents a network interface.
Codable Messaging 8
Coders that encode and decode Codable values for framed network messages.
- PrNetworkCoderiOS 26.0+A protocol for coders that encode and decode Codable network messages.
- PrNetworkEncoderiOS 26.0+A type that conforms to the NetworkEncoder protocol can encode a Encodable object
- PrNetworkDecoderiOS 26.0+A type that conforms to the NetworkEncoder protocol can decode data to an Encodable object
- StCoderiOS 26.0+A protocol that frames and encodes/decodes Codable types.
- StNetworkJSONCoderiOS 26.0+A coder that encodes and decodes network messages as JSON.
- StNetworkPropertyListCoderiOS 26.0+A coder that encodes and decodes network messages as property lists.
- PrNetworkFixedWidthIntegeriOS 26.0+A protocol for fixed-width integers usable in network message coding.
- PrOS_nw_content_contextThe underlying object type that frames a message's content and metadata.
Connection Reports 6
Diagnostic reports describing how connections were established, resolved, and used.
- Stnw_data_transfer_report_state_t@typedef nw_data_transfer_report_state_t
- Stnw_report_resolution_source_t@typedef nw_report_resolution_source_t
- Stnw_report_resolution_protocol_t@typedef nw_report_resolution_protocol_t
- PrOS_nw_establishment_reportThe underlying object type that reports how a connection was established.
- PrOS_nw_resolution_reportThe underlying object type that reports how an endpoint was resolved.
- PrOS_nw_data_transfer_reportThe underlying object type that reports data-transfer statistics for a connection.
Privacy and Proxy Configuration 5
Configuration for DNS resolution, proxies, relays, and privacy contexts.
- StProxyConfigurationiOS 17.0+A ProxyConfiguration object stores a proxy configuration. Proxy configurations can be added to a Privacy Context
- PrOS_nw_resolver_configThe underlying object type that configures DNS resolution.
- PrOS_nw_proxy_configThe underlying object type that configures a network proxy.
- PrOS_nw_relay_hopThe underlying object type that describes a relay hop in a connection path.
- PrOS_nw_privacy_contextThe underlying object type that defines a privacy context for connections.
Errors 3
Error types and domains reported by Network framework operations.
- EnNWErroriOS 12.0+NWError is a type to deliver error codes relevant to NWConnection and NWListener objects.
- Stnw_error_domain_t@typedef nw_error_domain_t
- PrOS_nw_errorThe underlying object type that represents a Network framework error.
Foundational Protocols 1
Base protocols shared by the framework's underlying object types.
- PrOS_nw_objectThe base protocol shared by all underlying Network framework object types.
Structures 2
- StProtocolMetadataBuilderiOS 26.0+A resultBuilder for configuring metadata in send methods in a declarative
- StProtocolStackBuilderiOS 26.0+A resultBuilder for specifying and configuring protocol stacks in
Type Aliases 87
- Tynw_object_t
- Tynw_txt_record_t
- Tynw_txt_record_access_key_t@typedef nw_txt_record_access_key_t
- Tynw_txt_record_access_bytes_t@typedef nw_txt_record_access_bytes_t
- Tynw_txt_record_applier_t@typedef nw_txt_record_applier_t
- Tynw_advertise_descriptor_t
- Tynw_protocol_definition_t
- Tynw_protocol_options_t
- Tynw_protocol_metadata_t
- Tynw_interface_t
- Tynw_endpoint_t
- Tynw_resolver_config_t
- Tynw_proxy_config_t
- Tynw_relay_hop_t
- Tynw_proxy_domain_enumerator_t
- Tynw_privacy_context_t
Show 71 more
- Tynw_parameters_t
- Tynw_protocol_stack_t
- Tynw_parameters_configure_protocol_block_t
- Tynw_parameters_iterate_interfaces_block_t
- Tynw_parameters_iterate_interface_types_block_t
- Tynw_protocol_stack_iterate_protocols_block_t
- Tynw_browse_descriptor_t
- Tynw_browse_result_t
- Tynw_browse_result_change_t@typedef nw_browse_result_change_t
- Tynw_browse_result_enumerate_interface_t@typedef nw_browse_result_enumerate_interface_t
- Tynw_error_t
- Tynw_browser_t
- Tynw_browser_browse_results_changed_handler_t@typedef nw_browser_browse_results_changed_handler_t
- Tynw_browser_state_changed_handler_t@typedef nw_browser_state_changed_handler_t
- Tynw_path_t
- Tynw_path_enumerate_interfaces_block_t
- Tynw_path_enumerate_gateways_block_t
- Tynw_content_context_t
- Tynw_connection_t
- Tynw_connection_state_changed_handler_t
- Tynw_connection_boolean_event_handler_t
- Tynw_connection_path_event_handler_t
- Tynw_connection_receive_completion_t@typedef nw_connection_receive_completion_t
- Tynw_connection_send_completion_t@typedef nw_connection_send_completion_t
- Tynw_group_descriptor_t
- Tynw_group_descriptor_enumerate_endpoints_block_t@typedef nw_group_descriptor_enumerate_endpoints_block_t
- Tynw_connection_group_t
- Tynw_connection_group_state_changed_handler_t@typedef nw_connection_group_state_changed_handler_t
- Tynw_connection_group_receive_handler_t@typedef nw_connection_group_receive_handler_t
- Tynw_connection_group_send_completion_t@typedef nw_connection_group_send_completion_t
- Tynw_connection_group_new_connection_handler_t@typedef nw_connection_group_new_connection_handler_t
- Tynw_establishment_report_t
- Tynw_establishment_report_access_block_t
- Tynw_resolution_report_t
- Tynw_report_resolution_enumerator_t
- Tynw_report_resolution_report_enumerator_t
- Tynw_report_protocol_enumerator_t
- Tynw_data_transfer_report_t
- Tynw_data_transfer_report_collect_block_t
- Tynw_ethernet_channel_t
- Tynw_ethernet_channel_state_changed_handler_t@typedef nw_ethernet_channel_state_changed_handler_t
- Tynw_ethernet_address_t@typedef nw_ethernet_address_t
- Tynw_ethernet_channel_receive_handler_t@typedef nw_ethernet_channel_receive_handler_t
- Tynw_ethernet_channel_send_completion_t@typedef nw_ethernet_channel_send_completion_t
- Tynw_framer_t
- Tynw_framer_message_t@typedef nw_framer_message_t
- Tynw_framer_message_dispose_value_t@typedef nw_framer_message_dispose_value_t
- Tynw_framer_start_handler_t@typedef nw_framer_start_result_t
- Tynw_framer_input_handler_t@typedef nw_framer_input_handler_t
- Tynw_framer_output_handler_t@typedef nw_framer_output_handler_t
- Tynw_framer_wakeup_handler_t@typedef nw_framer_wakeup_handler_t
- Tynw_framer_stop_handler_t@typedef nw_framer_stop_handler_t
- Tynw_framer_cleanup_handler_t@typedef nw_framer_cleanup_handler_t
- Tynw_framer_parse_completion_t@typedef nw_framer_parse_completion_t
- Tynw_framer_block_t@typedef nw_framer_block_t
- Tynw_listener_t
- Tynw_listener_state_changed_handler_t
- Tynw_listener_new_connection_handler_t@typedef nw_listener_new_connection_handler_t
- Tynw_listener_new_connection_group_handler_t@typedef nw_listener_new_connection_group_handler_t
- Tynw_listener_advertised_endpoint_changed_handler_t@typedef nw_listener_advertised_endpoint_changed_handler_t
- Tynw_path_monitor_t
- Tynw_path_monitor_cancel_handler_t@typedef nw_path_monitor_cancel_handler_t
- Tynw_path_monitor_update_handler_t@typedef nw_path_monitor_update_handler_t
- Tynw_ws_pong_handler_t@typedef nw_ws_pong_handler_t
- Tynw_ws_request_t
- Tynw_ws_subprotocol_enumerator_t@typedef nw_ws_subprotocol_enumerator_t
- Tynw_ws_additional_header_enumerator_t@typedef nw_ws_additional_header_enumerator_t
- Tynw_ws_response_t
- Tynw_ws_client_request_handler_t@typedef nw_ws_client_request_handler_t
- TyNetworkActorInterruptionHandlerA handler that is invoked when the underlying connection is interrupted. An attempt at creating
- TyNetworkActorInvalidationHandlerTODO: Do we need this stuff anymore...?