Preview:
        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)
            }
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter