T Neate T Neate - 3 months ago 24x
Swift Question

Firebase on Swift, how to get notified if a query is empty?

Hello I am using firebase in swift and I am trying to search through my users by user name using a query like so:

.observeEventType(.ChildAdded, withBlock: { snapshot in

This works great but I want to be notified if the query is empty aka the there is no user that has that user name. Can someone please show me how to edit how I format my search to allow for that? Thanks!


My tree looks like this:



username: "bob",

highscore: "1000"



upon changing event type to .Value, when using snapshot.value I no longer get the adjkadfjla ID. I now get the entire try below it


you can check if the snapshot exist, this will return a Bool