-
Notifications
You must be signed in to change notification settings - Fork 1
NetworkReachabilityManager
!(os(watchOS) || os(Linux))
-
The
NetworkReachabilityManager
class listens for reachability changes of hosts and addresses for both cellular and WiFi network interfaces.open class NetworkReachabilityManager
Reachability 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.
!(os(watchOS) || os(Linux))
-
A closure executed when the network reachability status changes. The closure takes a single argument: the network reachability status.
public typealias Listener = (NetworkReachabilityStatus) -> Void
!(os(watchOS) || os(Linux))
-
Creates an instance with the specified host.
public convenience init?(host: String)
- host: Host used to evaluate network reachability. Must not include the scheme (e.g.
https
).
- host: Host used to evaluate network reachability. Must not include the scheme (e.g.
!(os(watchOS) || os(Linux))
-
Creates an instance that monitors the address 0.0.0.0.
public convenience init?()
Reachability treats the 0.0.0.0 address as a special token that causes it to monitor the general routing status of the device, both IPv4 and IPv6.
!(os(watchOS) || os(Linux))
-
Default
NetworkReachabilityManager
for the zero address and alistenerQueue
of.main
.let `default`
!(os(watchOS) || os(Linux))
-
Whether the network is currently reachable.
var isReachable: Bool
!(os(watchOS) || os(Linux))
-
Whether the network is currently reachable over the cellular interface.
var isReachableOnCellular: Bool
!(os(watchOS) || os(Linux))
-
Whether the network is currently reachable over Ethernet or WiFi interface.
var isReachableOnEthernetOrWiFi: Bool
!(os(watchOS) || os(Linux))
-
DispatchQueue
on which reachability will update.let reachabilityQueue
!(os(watchOS) || os(Linux))
-
Flags of the current reachability type, if any.
var flags: SCNetworkReachabilityFlags?
!(os(watchOS) || os(Linux))
-
The current network reachability status.
var status: NetworkReachabilityStatus
!(os(watchOS) || os(Linux))
-
Starts listening for changes in network reachability status.
@discardableResult open func startListening(onQueue queue: DispatchQueue = .main, onUpdatePerforming listener: @escaping Listener) -> Bool
- queue:
DispatchQueue
on which to call thelistener
closure..main
by default. - listener:
Listener
closure called when reachability changes.
true
if listening was started successfully,false
otherwise. - queue:
!(os(watchOS) || os(Linux))
-
Stops listening for changes in network reachability status.
open func stopListening()
Generated at 2020-09-24T22:11:06+0000 using swift-doc 1.0.0-beta.4.
Types
- AF
- AFError
- AFError.MultipartEncodingFailureReason
- AFError.ParameterEncoderFailureReason
- AFError.ParameterEncoderFailureReason.RequiredComponent
- AFError.ParameterEncodingFailureReason
- AFError.ResponseSerializationFailureReason
- AFError.ResponseValidationFailureReason
- AFError.ServerTrustFailureReason
- AFError.ServerTrustFailureReason.Output
- AFError.URLRequestValidationFailureReason
- Adapter
- AlamofireExtension
- AlamofireNotifications
- ClosureEventMonitor
- CompositeEventMonitor
- CompositeTrustEvaluator
- ConnectionLostRetryPolicy
- DataRequest
- DataResponse
- DataResponseSerializer
- DecodableResponseSerializer
- DefaultTrustEvaluator
- DisabledEvaluator
- DownloadRequest
- DownloadRequest.Downloadable
- DownloadRequest.Options
- DownloadResponse
- Empty
- GoogleXSSIPreprocessor
- HTTPHeader
- HTTPHeaders
- HTTPMethod
- Interceptor
- JSONEncoding
- JSONParameterEncoder
- JSONResponseSerializer
- MultipartFormData
- NetworkReachabilityManager
- NetworkReachabilityManager.NetworkReachabilityStatus
- NetworkReachabilityManager.NetworkReachabilityStatus.ConnectionType
- PassthroughPreprocessor
- PinnedCertificatesTrustEvaluator
- PublicKeysTrustEvaluator
- Redirector
- Redirector.Behavior
- Request
- Request.State
- ResponseCacher
- ResponseCacher.Behavior
- Retrier
- RetryPolicy
- RetryResult
- RevocationTrustEvaluator
- RevocationTrustEvaluator.Options
- ServerTrustManager
- Session
- SessionDelegate
- StringResponseSerializer
- URLEncodedFormEncoder
- URLEncodedFormEncoder.ArrayEncoding
- URLEncodedFormEncoder.BoolEncoding
- URLEncodedFormEncoder.DataEncoding
- URLEncodedFormEncoder.DateEncoding
- URLEncodedFormEncoder.Error
- URLEncodedFormEncoder.KeyEncoding
- URLEncodedFormEncoder.SpaceEncoding
- URLEncodedFormParameterEncoder
- URLEncodedFormParameterEncoder.Destination
- URLEncoding
- URLEncoding.ArrayEncoding
- URLEncoding.BoolEncoding
- URLEncoding.Destination
- UploadRequest
- UploadRequest.Uploadable
Protocols
- AlamofireExtended
- CachedResponseHandler
- DataDecoder
- DataPreprocessor
- DataResponseSerializerProtocol
- DownloadResponseSerializerProtocol
- EmptyResponse
- EventMonitor
- ParameterEncoder
- ParameterEncoding
- RedirectHandler
- RequestAdapter
- RequestDelegate
- RequestInterceptor
- RequestRetrier
- ResponseSerializer
- ServerTrustEvaluating
- URLConvertible
- URLRequestConvertible
- UploadConvertible
- UploadableConvertible