How can I check for an active Internet connection on iOS or macOS?
Important: This check should always be performed asynchronously. The majority of answers below are synchronous so be careful otherwise you’ll freeze up your app. Swift Install via CocoaPods or Carthage: https://github.com/ashleymills/Reachability.swift Test reachability via closures let reachability = Reachability()! reachability.whenReachable = { reachability in if reachability.connection == .wifi { print(“Reachable via WiFi”) } else { … Read more