Firebaseui-ios: FUITableViewDataSource documentation for v1.0

Created on 9 Nov 2016  路  2Comments  路  Source: firebase/FirebaseUI-iOS

  • Objective C or Swift: Swift
  • iOS version: 10
  • Firebase SDK version: 3.9
  • FirebaseUI version: 1.0
  • CocoaPods Version: 1.2

Describe the problem:
Documentation for the latest FUITableViewDataSource seems to be incorrect for init and populating cells. It appears to use an escaping closure since version 1.0.
Would it be possible to get a few examples on how to use the new FUITableViewDataSource?

docs

Most helpful comment

FUITableViewDataSource no longer takes responsibility for creating the table view's cells, instead it passes the index path and table view and asks the consumer to dequeue cells. We've also added a convenience method to UITableView to make it easier to bind them to Firebase queries.

let dataSource = self.tableView.bind(to: query) { tableView, indexPath, snap in
  let cell = tableView.dequeueReusableCell(withReuseIdentifier: "identifier", for: indexPath)
  // do stuff with cell
  return cell
}
self.dataSource = dataSource

All 2 comments

FUITableViewDataSource no longer takes responsibility for creating the table view's cells, instead it passes the index path and table view and asks the consumer to dequeue cells. We've also added a convenience method to UITableView to make it easier to bind them to Firebase queries.

let dataSource = self.tableView.bind(to: query) { tableView, indexPath, snap in
  let cell = tableView.dequeueReusableCell(withReuseIdentifier: "identifier", for: indexPath)
  // do stuff with cell
  return cell
}
self.dataSource = dataSource

Docs should be updated now. Thanks for reporting 馃憤

Was this page helpful?
0 / 5 - 0 ratings