NetworkReachabilityMonitor
public class NetworkReachabilityMonitor : BaseMonitor
A NetworkReachabilityMonitor
instance monitors a network node name or
address for changes to its reachability.
-
Encapsulates changes to the reachability of a network node name or address.
See moreDeclaration
Swift
public enum Event
-
Encapsulates the reachability of a network node name or address.
See moreDeclaration
Swift
public enum Status
-
Initializes a new
NetworkReachabilityMonitor
for the network address0.0.0.0
(meaning “any IPv4 address at all”).Declaration
Swift
public init(queue: OperationQueue = .main, handler: @escaping (Event) -> Void) throws
Parameters
queue
The operation queue on which the handler executes. By default, the main operation queue is used.
handler
The handler to call when the reachability of the network node address changes.
-
Initializes a new
NetworkReachabilityMonitor
for the specified network node name.Declaration
Swift
public init(name: String, queue: OperationQueue = .main, handler: @escaping (Event) -> Void) throws
Parameters
name
The network node name of the desired host.
queue
The operation queue on which the handler executes. By default, the main operation queue is used.
handler
The handler to call when the reachability of the network node name changes.
-
A Boolean value indicating whether the network node name or address can be reached.
Declaration
Swift
public var isReachable: Bool { get }
-
A Boolean value indicating whether the network node name or address can be reached via a non-cellular connection.
Declaration
Swift
public var isReachableViaWiFi: Bool { get }
-
A Boolean value indicating whether the network node name or address can be reached via a cellular connection.
Declaration
Swift
public var isReachableViaWWAN: Bool { get }
-
The reachability of the network node name or address.
Declaration
Swift
public var status: Status { get }
-
Declaration
Swift
override public func cleanupMonitor()
-
Declaration
Swift
override public func configureMonitor()