Wait for completion handler to finish before returning – Ios swift
func checkUsername(username: String) -> Bool { var avalible = true Database.database().reference().child("usernames").child(username).observeSingleEvent(of: .value, with: { snapshot in if snapshot.exists() { print("exists") avalible = false } }) return available } I'm trying to check if a username exists. I've already tried multiple…