I've been looking for so long for a way to count all of my users from my firebase database and then put the result in a for loop
The problem is that the counter stay at 0 even when I count..
here is a screenshot of my firebase database
here is what I tried
var count = 0
FIRDatabase.database().reference().child("users").observe(.value, with: { (snapshot) in
count = Int(childrenCount)
})
for i in 0...count {
let card = ImageCard(frame: CGRect(x: 0, y: 0, width: self.view.frame.width - 60, height: self.view.frame.height * 0.6))
cards.append(card)
}
thank you !