currentPath
TypeScriptget currentPath(): NWPathSwift declarationfinal var currentPath: NWPath { get set }Access the current network path tracked by the monitor
class · iOS 12.0+ · SDK 27.1
final class NWPathMonitorThe NWPathMonitor allows the caller to fetch the current global path (or a path restricted to a specific network interface type). The path for the monitor is an observable property that will be updated upon each network change. Paths generated by a path monitor are not specific to a given endpoint, and will not have the localEndpoint or remoteEndpoint properties set. The paths will watch the state of multiple interfaces, and allows the application to enumerate the available interfaces for use in creating connections or listeners bound to specific interfaces.
get currentPath(): NWPathSwift declarationfinal var currentPath: NWPath { get set }Access the current network path tracked by the monitor
set currentPath(value: NWPath)Swift declarationfinal var currentPath: NWPath { get set }Access the current network path tracked by the monitor
get debugDescription(): stringSwift declarationfinal 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.
makeAsyncIterator(): NWPathMonitor_IteratorSwift declarationfinal func makeAsyncIterator() -> NWPathMonitor.IteratorCreates the asynchronous iterator that produces elements of this asynchronous sequence. - Returns: An instance of the `AsyncIterator` type used to produce elements of the asynchronous sequence.
get pathUpdateHandler(): (((arg0: NWPath) => Promise<void>)) | nullSwift declaration@preconcurrency final var pathUpdateHandler: (@Sendable (NWPath) -> Void)? { get set }Set a block to be called when the network path changes. pathUpdateHandler will not be called until `start` is called.
set pathUpdateHandler(value: (((arg0: NWPath) => void)) | null)Swift declaration@preconcurrency final var pathUpdateHandler: (@Sendable (NWPath) -> Void)? { get set }Set a block to be called when the network path changes. pathUpdateHandler will not be called until `start` is called.
static initRequiredInterfaceType(requiredInterfaceType: NWInterface_InterfaceType): NWPathMonitorSwift declarationinit(requiredInterfaceType: NWInterface.InterfaceType)Create a network path monitor that watches a single interface type.
static initProhibitedInterfaceTypes(prohibitedInterfaceTypes: Array<NWInterface_InterfaceType>): NWPathMonitorSwift declarationinit(prohibitedInterfaceTypes: [NWInterface.InterfaceType])Create a network path monitor that prohibits an array of interface types.
get queue(): (_Dispatch_DispatchQueue) | nullSwift declarationfinal var queue: DispatchQueue? { get }Get queue used for delivering the pathUpdateHandler block. If the path monitor has not yet been started, the queue will be nil. Once the path monitor has been started, the queue will be non-nil.
start(queue: _Dispatch_DispatchQueue): voidSwift declarationfinal func start(queue: DispatchQueue)Start the path monitor and set a queue on which path updates will be delivered. Start should only be called once on a monitor, and multiple calls to start will be ignored. Once started, the path monitor must be explicitly cancelled when it is no longer needed.
cancel(): voidSwift declarationfinal func cancel()Cancel the path monitor, after which point no more path updates will be delivered.
static init(): NWPathMonitorSwift declarationinit()Create a network path monitor to monitor overall network state for the system and to enumerate all interfaces that are available for general use by applications.
No declarations were skipped in this snapshot.