How to notify a queue in Swift (GCD)
问题 I'm using GCD to notify main thread (have 2 async calls inside the function) My code: func getWavesByMostRecent(closure: @escaping ([Wave]?) -> Void) { var waves = [Wave]() let dispatchGroup = DispatchGroup() self.query = DatabaseManager.waveRef.queryOrdered(byChild: Constants.reverseTimeStampKey) self.handle = self.query?.observe(.value, with: { (snapshot) in for value in snapshot.children { guard let wave = Wave(snapshot: value as! DataSnapshot) else { return } self.geoFire = GeoFire