使用 populateCellWithBlock FirebaseUI 时出错

Getting an error with populateCellWithBlock FirebaseUI

我遇到错误:

Cannot invoke 'populateCellWithBlock' with an argument list of type ((UITableViewCell, NSObject) -> Void)

我不知道为什么会这样。任何建议都会很棒。谢谢

self.dataSource.populateCellWithBlock { (cell: UITableViewCell, obj: NSObject) -> Void in
        let snap = obj as! FDataSnapshot
        cell.textLabel?.text = snap.value as? String
}

现在 FirebaseUI 接受 AnyObject 作为两个参数。您可以在闭包内部转换类型。

self.dataSource.populateCellWithBlock { (cell: AnyObject, obj: AnyObject) in
  let snap = obj as! FDataSnapshot
  let theCell = cell as! UITableViewCell
  theCell.textLabel?.text = snap.value as? String
}

我们正在努力在即将发布的版本中实现更好的 Swift 兼容性。