An object you use to browse for available network services.


final class NWBrowser


Browsing for Services

init(for: NWBrowser.Descriptor, using: NWParameters)

Initializes a browser with a type of service to discover.

enum NWBrowser.Descriptor

A service description used to discover Bonjour services.

func start(queue: DispatchQueue)

Starts browsing for services, and sets the queue on which all browser events will be delivered.

struct NWBrowser.Result

A set of discovered services and changes from the last result.

var browseResults: Set<NWBrowser.Result>

The list of discovered services.

Managing Browsers

var stateUpdateHandler: ((NWBrowser.State) -> Void)?

A handler that receives browser state updates.

enum NWBrowser.State

States indicating whether a browser is able to discover services.

var state: NWBrowser.State

The current state of the browser.

func cancel()

Stops browsing for services.

Inspecting Browsers

let descriptor: NWBrowser.Descriptor

The service descriptor with which the browser was initialized.

let parameters: NWParameters

The parameters with which the browser was initialized.

var queue: DispatchQueue?

The queue on which browser events are delivered.

var debugDescription: String

The description of the browser.


See Also

Connections and Listeners

class NWConnection

A bidirectional data connection between a local endpoint and a remote endpoint.

class NWListener

An object you use to listen for incoming network connections.

class NWEthernetChannel

An object you use to send and receive custom Ethernet frames.


Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software