我是 firebase 和 swift 编程的新手。我正在尝试使用 firebase 中的数据填充表格 View 。我在 self.dataSource 行不断收到(预期声明)错误。任何帮助将不胜感激,提前致谢...
import UIKit
import Firebase
import FirebaseUI
class ChurchTableViewController: UITableViewController {
var items = [NSDictionary]()
let firebaseRef = Firebase(url:"https://........com/")
let dataSource: FirebaseTableViewDataSource! = nil
self.dataSource = FirebaseTableViewDataSource(ref: self.firebase, cellReuseIdentifier: "Cell", view: self.tableView)
self.dataSource.populateCellWithBlock { (cell: UITableViewCell, obj: NSObject) -> Void in
let snap = items[indexPath.row]
//obj as! FDataSnapshot
// Populate cell as you see fit, like as below
cell.textLabel?.text = snap["ChurchName"] as String
}
self.tableView.dataSource = self.dataSource
我从 firebase 文档中得到了这个...
最佳答案
你的
let dataSource...
应该是
var dataSource...
let 用于表示不会改变的事情。
关于ios - Swift 2 FirebaseTableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36670544/