ReachabilityManagerType

public protocol ReachabilityManagerType

The ReachabilityManagerType describes entities that listen for reachability changes of hosts and addresses for both WWAN and WiFi network interfaces.

They can be used to determine background information about why a network operation failed, or to retry network requests when a connection is established. It should not be used to prevent a user from initiating a network request, as it’s possible that an initial request may be required to establish reachability.

  • The current network reachability status.

    Declaration

    Swift

    var networkReachabilityStatus: NetworkReachabilityStatus { get }
  • Sets a closure executed when the network reachability status changes.

    Declaration

    Swift

    func registerListener(_ listener: @escaping ReachabilityStatusListener)
  • Starts listening for changes in network reachability status.

    Declaration

    Swift

    @discardableResult
    func startListening() -> Bool

    Return Value

    true if listening was started successfully, false otherwise.

  • Stops listening for changes in network reachability status.

    Declaration

    Swift

    func stopListening()
  • isReachable Extension method

    Whether the network is currently reachable.

    Declaration

    Swift

    var isReachable: Bool { get }
  • isReachableOnWWAN Extension method

    Whether the network is currently reachable over the WWAN interface.

    Declaration

    Swift

    var isReachableOnWWAN: Bool { get }
  • isReachableOnEthernetOrWiFi Extension method

    Whether the network is currently reachable over Ethernet or WiFi interface.

    Declaration

    Swift

    var isReachableOnEthernetOrWiFi: Bool { get }