Last active
February 7, 2021 16:05
-
-
Save popcornomnom/471b57eb76f540ca16fd672a375caa78 to your computer and use it in GitHub Desktop.
Handling Internet Connection reachability Swift 5. Article link: http://www.popcornomnom.com/handling-internet-connection-reachability-on-ios-swift-5/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReachabilityHandler: ReachabilityObserverDelegate { | |
//MARK: Lifecycle | |
required init() { | |
try? addReachabilityObserver() | |
} | |
deinit { | |
removeReachabilityObserver() | |
} | |
//MARK: Reachability | |
func reachabilityChanged(_ isReachable: Bool) { | |
if !isReachable { | |
print("No internet connection") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment