title: Firebase observeSingleEvent completion handler
body: <p>I have a FirebaseManager class and a get data function.
  When calling this function, I need to get this data in the place from which it is called.
  I am trying to do something like</p>
  <pre><code>import Firebase
  
  class FirebaseManager {
      
      var ref = Database.database().reference()
   
      func getData (path: String) -&gt; DataSnapshot {
          
          self.ref.child(path).observeSingleEvent(of: .value) { (snapshot) in
              if snapshot.exists() {
                  print(snapshot.value!)
          return snapshot // XCODE ERROR - Cannot convert return expression of type 'Void' to return type 'DataSnapshot'
              } else {
                  print(&quot;No data by path \(path)&quot;)
              }
          }
      }
  }
  </code></pre>