func getCount()

in firestore/swift/firestore-smoketest/SolutionCountersViewController.swift [74:89]


    func getCount(ref: DocumentReference) {
        ref.collection("shards").getDocuments() { (querySnapshot, err) in
            var totalCount = 0
            if err != nil {
                // Error getting shards
                // ...
            } else {
                for document in querySnapshot!.documents {
                    let count = document.data()["count"] as! Int
                    totalCount += count
                }
            }

            print("Total count is \(totalCount)")
        }
    }