ConnectivityManager Class Reference
public class ConnectivityManager : ConnectivityManagerProtocol
A manager that handles system connectivity monitor and empirical connectivity monitor to establish when connectivity is actually available or not on the device.
The default behavior would be to always assume that connectivity is available until system monitor or empirical connectivity result unavailable or unknown.
-
The shared instance of the
ConnectivityManagerDeclaration
Swift
public static let shared: ConnectivityManager -
Declaration
Swift
public func waitingForConnectivity(_ task: URLSessionTask) -
Returns
trueif either monitored or empirical connectivity result availableDeclaration
Swift
public var isConnectionAssumedAvailable: Bool { get } -
The current network connection state from the connectivity monitor.
Declaration
Swift
public var connection: ObservableState<NetworkConnection> { get } -
An observable that emits
truewhen connection is assumed to be available andfalsewhen it’s assumed to be unavailable.The internal behavior is to merge the information from the system connectivity monitor and the result of network requests and only report as unavailable when both do so or if empirical is unavailable and the monitored one is unknown.
Declaration
Swift
@StateSubject public var connectionAssumedAvailable: ObservableState<Bool> { get } -
Declaration
Swift
public func didComplete(_ request: URLRequest, with response: NetworkResult) -
Declaration
Swift
public func shouldRetry(_ request: URLRequest, retryCount: Int, with response: NetworkResult) -> RetryPolicy