title: How to handle internet connection status Firebase
body: <p>I want to check if an device (in this case an IOS device) has access to the Firebase Realtime Database.</p>
  
  <p>So I have created this method:</p>
  
  <pre><code>private func isConnected(completionHandler : @escaping (Bool) -&gt; ()) {
     let connectedRef = Database.database().reference(withPath: ".info/connected")
         connectedRef.observe(.value, with: { snapshot in
              completionHandler((snapshot.value as? Bool)!)
         })
  }
  </code></pre>
  
  <p>This method is working perfect. And I'm using it like this in every method where I'm doing something with the realtime database:</p>
  
  <pre><code>isConnected { (connected) in
      if(connected){
           //do your things
      } else {
         print("network error")
      }                       
  }
  </code></pre>
  
  <p>But now my question, what if you get the network error. How do you know if your device has no internet connection or the Firebase service is down? What is a good approach to do this? Because the only thing I know right now is that I can't reach the realtime database.</p>
  
  <p>So my question is, how can I get more detailed information? Isthe device offline? Is firebase down? etc etc. </p>