Couchbase Lite
Objective-C API for iOS and Mac OS
CBLUITableSource Class Reference

Detailed Description

A UITableView data source driven by a CBLLiveQuery.

It populates the table rows from the query rows, and automatically updates the table as the query results change when the database is updated. A CBLUITableSource can be created in a nib. If so, its tableView outlet should be wired up to the UITableView it manages, and the table view's dataSource outlet should be wired to it.

Inheritance diagram for CBLUITableSource:

Instance Methods

(void) - reloadFromQuery
 Rebuilds the table from the query's current .rows property. More...
 
() - CBLArrayOf
 The current array of CBLQueryRows being used as the data source for the table. More...
 
(nullable CBLQueryRow *) - rowAtIndex:
 Convenience accessor to get the row object for a given table row index. More...
 
(nullable NSIndexPath *) - indexPathForDocument:
 Convenience accessor to find the index path of the row with a given document. More...
 
(nullable CBLQueryRow *) - rowAtIndexPath:
 Convenience accessor to return the query row at a given index path. More...
 
(nullable CBLDocument *) - documentAtIndexPath:
 Convenience accessor to return the document at a given index path. More...
 
(BOOL) - deleteDocumentsAtIndexes:error:
 Deletes the documents at the given row indexes, animating the removal from the table. More...
 
(BOOL) - deleteDocuments:error:
 Asynchronously deletes the given documents, animating the removal from the table. More...
 

Properties

IBOutlet UITableView * tableView
 The table view to manage. More...
 
CBLLiveQueryquery
 The query whose rows will be displayed in the table. More...
 
UITableViewRowAnimation rowInsertAnimation
 Animation used when inserting new rows; default is UITableViewRowAnimationAutomatic. More...
 
UITableViewRowAnimation rowDeleteAnimation
 Animation used when deleting rows; default is UITableViewRowAnimationAutomatic. More...
 
UITableViewRowAnimation rowReplaceAnimation
 Animation used when replacing rows; default is UITableViewRowAnimationAutomatic. More...
 
NSString * labelProperty
 If non-nil, specifies the property name of the query row's value that will be used for the table row's visible label. More...
 
BOOL deletionAllowed
 Is the user allowed to delete rows by UI gestures? (Defaults to NO.) More...
 

Method Documentation

◆ reloadFromQuery()

- (void) reloadFromQuery

Rebuilds the table from the query's current .rows property.

◆ CBLArrayOf()

- CBLArrayOf (CBLQueryRow *) 

The current array of CBLQueryRows being used as the data source for the table.

◆ rowAtIndex:()

- (nullable CBLQueryRow*) rowAtIndex: (NSUInteger)  index

Convenience accessor to get the row object for a given table row index.

◆ indexPathForDocument:()

- (nullable NSIndexPath*) indexPathForDocument: (CBLDocument *)  document

Convenience accessor to find the index path of the row with a given document.

◆ rowAtIndexPath:()

- (nullable CBLQueryRow*) rowAtIndexPath: (NSIndexPath *)  path

Convenience accessor to return the query row at a given index path.

◆ documentAtIndexPath:()

- (nullable CBLDocument*) documentAtIndexPath: (NSIndexPath *)  path

Convenience accessor to return the document at a given index path.

◆ deleteDocumentsAtIndexes:error:()

- (BOOL) deleteDocumentsAtIndexes: (CBLArrayOf(NSIndexPath *) *)  indexPaths
error: (NSError **)  outError 

Deletes the documents at the given row indexes, animating the removal from the table.

◆ deleteDocuments:error:()

- (BOOL) deleteDocuments: (CBLArrayOf(CBLDocument *) *)  documents
error: (NSError **)  outError 

Asynchronously deletes the given documents, animating the removal from the table.

Property Documentation

◆ tableView

- (IBOutlet UITableView*) tableView
readwritenonatomicretain

The table view to manage.

◆ query

- (CBLLiveQuery*) query
readwriteatomicretain

The query whose rows will be displayed in the table.

◆ rowInsertAnimation

- (UITableViewRowAnimation) rowInsertAnimation
readwritenonatomicassign

Animation used when inserting new rows; default is UITableViewRowAnimationAutomatic.

◆ rowDeleteAnimation

- (UITableViewRowAnimation) rowDeleteAnimation
readwritenonatomicassign

Animation used when deleting rows; default is UITableViewRowAnimationAutomatic.

◆ rowReplaceAnimation

- (UITableViewRowAnimation) rowReplaceAnimation
readwritenonatomicassign

Animation used when replacing rows; default is UITableViewRowAnimationAutomatic.

◆ labelProperty

- (NSString*) labelProperty
readwriteatomiccopy

If non-nil, specifies the property name of the query row's value that will be used for the table row's visible label.

If the row's value is not a dictionary, or if the property doesn't exist, the property will next be looked up in the document's properties. If this doesn't meet your needs for labeling rows, you should implement -couchTableSource:willUseCell:forRow: in the table's delegate.

◆ deletionAllowed

- (BOOL) deletionAllowed
readwritenonatomicassign

Is the user allowed to delete rows by UI gestures? (Defaults to NO.)


The documentation for this class was generated from the following file: