Skip to content

Instantly share code, notes, and snippets.

@popcornomnom
Last active February 7, 2021 16:05
Show Gist options
  • Save popcornomnom/471b57eb76f540ca16fd672a375caa78 to your computer and use it in GitHub Desktop.
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/
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