Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift FirebaseUI:在使用FUIIndexTableViewDataSource时,如何在segue期间访问indexPath处的对象?_Swift_Uitableview_Firebase Realtime Database_Segue_Firebaseui - Fatal编程技术网

Swift FirebaseUI:在使用FUIIndexTableViewDataSource时,如何在segue期间访问indexPath处的对象?

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.

我正在使用FUIIndexTableViewDataSource,如上所述

我想在点击项目时显示详细视图控制器,但我不知道在准备继续时如何获取引用、键或数据。

我的代码:

    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的属性,对吗?