ConnectivityObserver
public protocol ConnectivityObserver : AnyObject
Observer protocol for receiving information about connectivity type changes.
-
Called when the connection type changes from offline/unknown to connected to any type of network.
Declaration
Swift
func connectionEstablished()
-
Called when the device changes its network connection, e.g. from offline/unknown to connected to WiFi, or from WiFi to a mobile data connection etc. The previous ReachabilityType and the current ReachabilityType are passed. ReachabilityTypes are defined in
ReachabilityType
, such asReachabilityType.wwan
orReachabilityType.wifi
.Declaration
Swift
func connectionChanged(_ previousReachabilityType: ReachabilityType, reachabilityType: ReachabilityType)
Parameters
previousReachabilityType
as defined in
ReachabilityType
, offline/unknown if not connected.reachabilityType
as defined in
ReachabilityType
, offline/unknown if not connected. -
Called when the device is disconnected from the network.
Declaration
Swift
func connectionLost()