title: Check internet connection (iOS 10)
body: <p>For iOS 9 I was using Reachability public class to check wether the device is connected to the internet or not. I converted my Swift 2 code to Swift 3, and the Reachability doesn't work anymore. Can someone tell me how to check the internet connection on iOS 10? Thanks!
  Here's the code snippet:</p>
  
  <pre><code>open class Reachability {
      class func isConnectedToNetwork() -&gt; Bool {
          var zeroAddress = sockaddr_in()
          zeroAddress.sin_len = UInt8(MemoryLayout.size(ofValue: zeroAddress))
          zeroAddress.sin_family = sa_family_t(AF_INET)
          let defaultRouteReachability = withUnsafePointer(to: &amp;zeroAddress) {
              SCNetworkReachabilityCreateWithAddress(nil, UnsafePointer($0))
          }
          var flags = SCNetworkReachabilityFlags()
          if !SCNetworkReachabilityGetFlags(defaultRouteReachability!, &amp;flags) {
              return false
          }
          let isReachable = (flags.rawValue &amp; UInt32(kSCNetworkFlagsReachable)) != 0
          let needsConnection = (flags.rawValue &amp; UInt32(kSCNetworkFlagsConnectionRequired)) != 0
          return (isReachable &amp;&amp; !needsConnection)
      }
  }
  </code></pre>