Swift FirebaseUI:在使用FUIIndexTableViewDataSource时,如何在segue期间访问indexPath处的对象?
我正在使用FUIIndexTableViewDataSource,如上所述 我想在点击项目时显示详细视图控制器,但我不知道在准备继续时如何获取引用、键或数据。 我的代码:Swift FirebaseUI:在使用FUIIndexTableViewDataSource时,如何在segue期间访问indexPath处的对象?,swift,uitableview,firebase-realtime-database,segue,firebaseui,Swift,Uitableview,Firebase Realtime Database,Segue,Firebaseui,我正在使用FUIIndexTableViewDataSource,如上所述 我想在点击项目时显示详细视图控制器,但我不知道在准备继续时如何获取引用、键或数据。 我的代码: override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if segue.identifier == "showDetail" { if let indexPath = self.tableView.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showDetail" {
if let indexPath = self.tableView.indexPathForSelectedRow {
// HELP: How do I access the firebase reference, index, and data from here?
}
}
}
在setupDatabase()函数中,我设置了数据源
self.dataSource = self.tableView.bind(
toIndexedQuery: chatKeysRef,
data: chatDataRef,
delegate: self,
populateCell: {
(tableView, indexPath, dataSnapshot) in
let cell = tableView.dequeueReusableCell(withIdentifier: "Chat", for: indexPath);
if (dataSnapshot == nil) {
cell.textLabel?.text = "";
cell.detailTextLabel?.text = "";
return cell;
}
cell.textLabel?.text = "hello world"
if (dataSnapshot!.hasChild("most_recent_message")) {
cell.detailTextLabel?.text = dataSnapshot?.childSnapshot(forPath: "most_recent_message").value as? String;
}
return cell;
});
FUIIndexTableViewDataSource似乎没有任何公共属性或方法可以帮助我:
Readme.md引用了FUIDataSource,但在FUIIndexTableViewDataSource中似乎没有 所选行的数据可以这样读取
let snapshot: DataSnapshot = self.dataSource.items[indexPath.row]
所选行的数据可以这样读取
let snapshot: DataSnapshot = self.dataSource.items[indexPath.row]
这似乎不是FUIIndexTableViewDataSource的属性,对吗?这似乎不是FUIIndexTableViewDataSource的属性,对吗?