title: Reachability returns False for Cellular network in iOS - Swift
body: <p>I have this code for checking internet connection , it was working very well until I update to Xcode 8 and swift 3 . Now it returns false for Cellular network and true for WiFi network I don't know why.</p>
  
  <p>This is the code :</p>
  
  <pre><code>open class Reachability { 
  
  class func isConnectedToNetwork() -&gt; Bool {
  
      var zeroAddress = sockaddr_in(sin_len: 0, sin_family: 0, sin_port: 0, sin_addr: in_addr(s_addr: 0), sin_zero: (0, 0, 0, 0, 0, 0, 0, 0))
      zeroAddress.sin_len = UInt8(MemoryLayout.size(ofValue: zeroAddress))
      zeroAddress.sin_family = sa_family_t(AF_INET)
  
      let defaultRouteReachability = withUnsafePointer(to: &amp;zeroAddress) {
          $0.withMemoryRebound(to: sockaddr.self, capacity: 1) {zeroSockAddress in
              SCNetworkReachabilityCreateWithAddress(nil, zeroSockAddress)
          }
      }
      var flags: SCNetworkReachabilityFlags = SCNetworkReachabilityFlags(rawValue: 0)
      if SCNetworkReachabilityGetFlags(defaultRouteReachability!, &amp;flags) == false {
          return false
      }
  
      let isReachable = flags == .reachable
      let needsConnection = flags == .connectionRequired
  
      return isReachable &amp;&amp; !needsConnection
  
    }
  }
  </code></pre>
  
  <p>Now how to make this function return true for both wifi and cellular connection ?</p>