Just started learning Swift, and spent the last 3 days tearing my hair out because I couldn't figure out why my
Value event listener was being called twice. I was trying to attach a timestamp to an object I was persisting in Firebase, using the function:
FirebaseServerValue.timestamp()
After saving my object, I noticed that my
Value event listener was being triggered
twice. Speaking to you as a bald man, I figured out that the added timestamp was what was causing the issue. Not entirely sure why this happens? Maybe the object is persisted to the database first, and then the timestamp added immediately after, causing the
Value event listener to trigger twice? Don't know. If anyone has an explanation for this, that'll be great!