Snippets Collections
        var a = 0
        var b = 0
        let group = DispatchGroup()
            group.enter()

            DispatchQueue.main.async {
                FireStore.getDocument("Users", "") { (doc, v) in
                    a = 1
                    group.leave()
                }
            }
        group.enter()
           DispatchQueue.main.async {
            FireStore.getDocument("Users", "") { (doc, v) in
                b = 1
                group.leave()
            }
          }
        
            group.notify(queue: .main) {
                print("a = ", a)
                print("b = ", b)
            }
star

Thu Jun 23 2022 08:13:46 GMT+0000 (Coordinated Universal Time)

#ios #swift #wait #await

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension