目前,如下面的代码所示,我的 tableview 显示了 Firebase 的所有内容。如何将列表限制在附近?
DataService.dataService.BUSINESS_REF.observeEventType(.Value, withBlock: { snapshot in
// A snapshot of the businesses data
self.businesses = []
if let snapshots = snapshot.children.allObjects as? [FDataSnapshot] {
for snap in snapshots {
// Make business array for the tableview
if let postDictionary = snap.value as? Dictionary<String, AnyObject> {
let key = snap.key
let business = Business(key: key, dictionary: postDictionary)
// Show newest business first
self.businesses.insert(business, atIndex: 0)
}
}
}
// Update the table when there is new data
self.searchTableView.reloadData()
})
我是 iOS 编程的新手,上面的代码来自教程,我意识到我需要使用 GeoFire 的 GFQuery 对象,但我就是不知道在我的代码中放在哪里。提前致谢!