Wednesday, December 7, 2022
HomeiOS Developmentios - Find out how to make firebase asynchronous perform run so...

ios – Find out how to make firebase asynchronous perform run so as

I’ve these two capabilities. What this does is examine if the my firebase realtime database has a customers UUID in it or not. Sadly I discovered this code doesn’t work. I assumed this might run so as however my perform isIDUsed() will get returned earlier than the database has an opportunity to examine if the worth exists or not. So it all the time returns the worth inDatabase is initialized in. Which is fake

I’ve tried to implement a semaphore however im new to swift and simply cant appear to get the syntax right. Please let me know if in case you have an answer thanks

func isIdUsed(ID: String) -> Bool{
    var databasedictionary: NSDictionary = NSDictionary()
    var inDatabase = false
    "TotalUsers").observeSingleEvent(of: .worth, with: { snapshot in
        let worth = snapshot.worth as? NSDictionary

        databasedictionary = worth! as NSDictionary

        if totalUsersCheck(totalUsers: databasedictionary, ID: ID) {
            inDatabase = true
          // ...
    }) { error in
    return inDatabase


func totalUsersCheck(totalUsers: NSDictionary, ID: String) -> Bool{
    if totalUsers[ID] != nil {
        return true
    return false



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments