title: Swift 2.2 - value is not persisted after function execution
body: <p>I created the function above to check if a user exists on Firebase database:</p>
  
  <pre><code>func userExists(userUid: String) -&gt; Bool {
      var userExists: Bool = false
      DBRef.child("users").child(userUid).observeSingleEventOfType(.Value, withBlock: { (snapshot: FIRDataSnapshot) in
          if snapshot.exists(){
              userExists = true
          }else{
              userExists = false
          }
      })
      return userExists
  }
  </code></pre>
  
  <p>The problem is that the userExists function always returns "false", even if the userExists variable is setted as true inside the withBlock. Any help, please? Thanks!</p>