Class

NWPathMonitor

An observer that you use to monitor and react to network changes.

Declaration

final class NWPathMonitor

Topics

Creating Path Monitors

init()

Initializes a path monitor to observe all available interface types.

init(requiredInterfaceType: NWInterface.InterfaceType)

Initializes a path monitor to observe a specific interface type.

func start(queue: DispatchQueue)

Starts monitoring path changes, and sets a queue on which to deliver path events.

var queue: DispatchQueue?

The queue on which path events are delivered.

Handling Path Updates

var currentPath: NWPath

The currently available network path observed by the path monitor.

var pathUpdateHandler: ((NWPath) -> Void)?

A handler that receives network path updates.

Canceling Path Monitors

func cancel()

Stops receiving network path updates.

See Also

Paths and Interfaces

struct NWPath

An object that contains information about the properties of the network that a connection uses, or that are available to your app.

struct NWInterface

An interface that a network connection uses to send and receive data.

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