Basically, I have a structure called, topics which contains Title, Description and a Published flag (see screenshot below for clarific
You have a few small mistakes in there. Overall nothing too bad, but combined they'll never work:
query... methods returns a new objectorderByChild() before you can filter on its valueCombining these:
let ref = FIRDatabase.database().referenceFromURL(FIREBASE_URL).child("topics")
let query = ref.queryOrderedByChild("published").queryEqualToValue(true)
query.observeEventType(.Value, withBlock: { (snapshot) in
for childSnapshot in snapshot.children {
print(childSnapshot)
}
})
We get this question regularly. For example, this from yesterday looks very similar: Firebase Query not Executing Properly. Since my explanation varies with every answer, I recommend browsing a bit to read my relevant answers until it clicks.