title: Swift - Firebase search in database
body: <p>I search for users while typing. However at the end it returns every users.
  I don't know why exactly this happens. It seems alright</p>
  
  <pre><code> class func findUsers(text: String)-&gt;[User]{
      let user = User()
      var users = [User]()
      ref.child("Users").queryOrderedByChild("name").queryStartingAtValue(text).observeEventType(.Value, withBlock: { snapshot in
          for u in snapshot.children{
              user.name = u.value!["name"] as? String
              user.surname = u.value!["surname"] as? String
              user.email = u.value!["email"] as? String
              user.score = u.value!["score"] as? Int
              user.status = u.value!["status"] as? Int
              user.id = u.value!["id"] as? String
              user.pin = u.value!["pin"] as? String
              users.append(user)
              print(user.name)
          }
      })
      print("users:", users)
      return users
  }
  </code></pre>