FirebaseTableViewDataSource Class Reference

Inherits from FirebaseDataSource : NSObject
Conforms to UITableViewDataSource
Declared in FirebaseTableViewDataSource.h

Overview

FirebaseTableViewDataSource provides an class that conforms to the UITableViewDataSource protocol which allows UITableViews to implement FirebaseTableViewDataSource in order to provide a UITableView synchronized to a Firebase reference or query. In addition to handling all Firebase child events (added, changed, removed, moved), FirebaseTableViewDataSource handles UITableViewCell creation, either with the default UITableViewCell, prototype cells, custom UITableViewCell subclasses, or custom XIBs, and provides a simple [FirebaseTableViewDataSource populateCellWithBlock:] method which allows developers to populate the cells created for them with desired data from Firebase.

  modelClass

The model class to coerce FDataSnapshots to (if desired). For instance, if the modelClass is set to [Message class] in Obj-C or Message.self in Swift, then objects of type Message will be returned instead of type FDataSnapshot.

@property (strong, nonatomic, __NON_NULL) Class modelClass

Discussion

The model class to coerce FDataSnapshots to (if desired). For instance, if the modelClass is set to [Message class] in Obj-C or Message.self in Swift, then objects of type Message will be returned instead of type FDataSnapshot.

Declared In

FirebaseTableViewDataSource.h

  reuseIdentifier

The reuse identifier for cells in the UITableView.

@property (strong, nonatomic, __NON_NULL) NSString *reuseIdentifier

Discussion

The reuse identifier for cells in the UITableView.

Declared In

FirebaseTableViewDataSource.h

  tableView

The UITableView instance that operations (inserts, removals, moves, etc.) are performed against.

@property (strong, nonatomic, __NON_NULL) UITableView *tableView

Discussion

The UITableView instance that operations (inserts, removals, moves, etc.) are performed against.

Declared In

FirebaseTableViewDataSource.h

  hasPrototypeCell

Property to keep track of prototype cell use, to not register a class for the UICollectionView or do similar book keeping.

@property BOOL hasPrototypeCell

Discussion

Property to keep track of prototype cell use, to not register a class for the UICollectionView or do similar book keeping.

Declared In

FirebaseTableViewDataSource.h

  populateCell

The callback to populate a subclass of UITableViewCell with an object provided by the datasource.

@property (strong, nonatomic, __NON_NULL) void ( ^ ) ( __KINDOF ( UITableViewCell ) __NON_NULL_PTR cell , __KINDOF ( NSObject ) __NON_NULL_PTR object ) populateCell

Discussion

The callback to populate a subclass of UITableViewCell with an object provided by the datasource.

Declared In

FirebaseTableViewDataSource.h

– initWithRef:cellReuseIdentifier:view:

Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with FDataSnapshots.

- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView

Parameters

ref

A Firebase reference to bind the datasource to

identifier

A string to use as a CellReuseIdentifier

tableView

An instance of a UITableView to bind to

Return Value

An instance of FirebaseTableViewDataSource that populates UITableViewCells with FDataSnapshots

Discussion

Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with FDataSnapshots.

Declared In

FirebaseTableViewDataSource.h

– initWithRef:prototypeReuseIdentifier:view:

Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with FDataSnapshots. Note that this method is used when using prototype cells, where the cells don’t need to be registered in the class.

- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref prototypeReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView

Parameters

ref

A Firebase reference to bind the datasource to

identifier

A string to use as a CellReuseIdentifier

tableView

An instance of a UITableView to bind to

Return Value

An instance of FirebaseTableViewDataSource that populates UITableViewCells with FDataSnapshots

Discussion

Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with FDataSnapshots. Note that this method is used when using prototype cells, where the cells don’t need to be registered in the class.

Declared In

FirebaseTableViewDataSource.h

– initWithRef:cellClass:cellReuseIdentifier:view:

Initialize an instance of FirebaseTableViewDataSource that populates a custom subclass of UITableViewCell with FDataSnapshots.

- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellClass:(__NULLABLE Class)cell cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView

Parameters

ref

A Firebase reference to bind the datasource to

cell

A subclass of UITableViewCell used to populate the UITableView, defaults to UITableViewCell if nil

identifier

A string to use as a CellReuseIdentifier

tableView

An instance of a UITableView to bind to

Return Value

An instance of FirebaseTableViewDataSource that populates a custom subclass of UITableViewCell with FDataSnapshots

Discussion

Initialize an instance of FirebaseTableViewDataSource that populates a custom subclass of UITableViewCell with FDataSnapshots.

Declared In

FirebaseTableViewDataSource.h

– initWithRef:nibNamed:cellReuseIdentifier:view:

Initialize an instance of FirebaseTableViewDataSource that populates a custom xib with FDataSnapshots.

- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref nibNamed:(__NON_NULL NSString *)nibName cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView

Parameters

ref

A Firebase reference to bind the datasource to

nibName

The name of a xib file to create the layout for a UITableViewCell

identifier

A string to use as a CellReuseIdentifier

tableView

An instance of a UITableView to bind to

Return Value

An instance of FirebaseTableViewDataSource that populates a custom xib with FDataSnapshots

Discussion

Initialize an instance of FirebaseTableViewDataSource that populates a custom xib with FDataSnapshots.

Declared In

FirebaseTableViewDataSource.h

– initWithRef:modelClass:cellReuseIdentifier:view:

Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom model class.

- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView

Parameters

ref

A Firebase reference to bind the datasource to

model

A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil

identifier

A string to use as a CellReuseIdentifier

tableView

An instance of a UITableView to bind to

Return Value

An instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom model class

Discussion

Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom model class.

Declared In

FirebaseTableViewDataSource.h

– initWithRef:modelClass:prototypeReuseIdentifier:view:

Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom model class. Note that this method is used when using prototype cells, where the cells don’t need to be registered in the class.

- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model prototypeReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView

Parameters

ref

A Firebase reference to bind the datasource to

model

A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil

identifier

A string to use as a CellReuseIdentifier

tableView

An instance of a UITableView to bind to

Return Value

An instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom model class

Discussion

Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom model class. Note that this method is used when using prototype cells, where the cells don’t need to be registered in the class.

Declared In

FirebaseTableViewDataSource.h

– initWithRef:modelClass:cellClass:cellReuseIdentifier:view:

Initialize an instance of FirebaseTableViewDataSource that populates a custom subclass of UITableViewCell with a custom model class.

- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellClass:(__NULLABLE Class)cell cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView

Parameters

ref

A Firebase reference to bind the datasource to

model

A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil

cell

A subclass of UITableViewCell used to populate the UITableView, defaults to UITableViewCell if nil

identifier

A string to use as a CellReuseIdentifier

tableView

An instance of a UITableView to bind to

Return Value

An instance of FirebaseTableViewDataSource that populates a custom subclass of UITableViewCell with a custom model class

Discussion

Initialize an instance of FirebaseTableViewDataSource that populates a custom subclass of UITableViewCell with a custom model class.

Declared In

FirebaseTableViewDataSource.h

– initWithRef:modelClass:nibNamed:cellReuseIdentifier:view:

Initialize an instance of FirebaseTableViewDataSource that populates a custom xib with a custom model class.

- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model nibNamed:(__NON_NULL NSString *)nibName cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UITableView *)tableView

Parameters

ref

A Firebase reference to bind the datasource to

model

A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil

nibName

The name of a xib file to create the layout for a UITableViewCell

identifier

A string to use as a CellReuseIdentifier

tableView

An instance of a UITableView to bind to

Return Value

An instance of FirebaseTableViewDataSource that populates a custom xib with a custom model class

Discussion

Initialize an instance of FirebaseTableViewDataSource that populates a custom xib with a custom model class.

Declared In

FirebaseTableViewDataSource.h

– populateCellWithBlock:

This method populates the fields of a UITableViewCell or subclass given a model object (or FDataSnapshot).

- (void)populateCellWithBlock:(__NON_NULL void ( ^ ) ( __KINDOF ( UITableViewCell ) __NON_NULL_PTR cell , __KINDOF ( NSObject ) __NON_NULL_PTR object ))callback

Parameters

callback

A block which returns an initialized UITableViewCell (or subclass) and the corresponding object to populate the cell with.

Discussion

This method populates the fields of a UITableViewCell or subclass given a model object (or FDataSnapshot).

Declared In

FirebaseTableViewDataSource.h