File tree Expand file tree Collapse file tree 4 files changed +32
-10
lines changed Expand file tree Collapse file tree 4 files changed +32
-10
lines changed Original file line number Diff line number Diff line change 25
25
26
26
NS_ASSUME_NONNULL_BEGIN
27
27
28
+ /* *
29
+ * A protocol representing a collection of objects from Firebase Database.
30
+ */
28
31
@protocol FUICollection <NSObject >
29
32
30
33
@property (nonatomic , readonly , copy ) NSArray <FIRDataSnapshot *> *items;
31
34
32
35
@property (weak , nonatomic , nullable ) id <FUICollectionDelegate> delegate;
33
36
34
37
/* *
35
- * The number of objects in the FirebaseArray .
38
+ * The number of objects in the collection .
36
39
*/
37
40
@property (nonatomic , readonly ) NSUInteger count;
38
41
42
+ /* *
43
+ * The @c FIRDataSnapshot at the given index. May raise fatal errors
44
+ * if the index is out of bounds.
45
+ * @param index The index of a snapshot.
46
+ */
39
47
- (FIRDataSnapshot *)snapshotAtIndex : (NSInteger )index ;
40
48
49
+ /* *
50
+ * Calling this makes the array begin observing updates from its query.
51
+ * Before this call is made the array is inert and doesn't do anything.
52
+ */
41
53
- (void )observeQuery ;
54
+
55
+ /* *
56
+ * Cancels all active observations. The array may be reused after this
57
+ * is called by calling @c observeQuery again.
58
+ */
42
59
- (void )invalidate ;
43
60
44
61
@end
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ NS_ASSUME_NONNULL_BEGIN
53
53
* UICollectionViewCells with FIRDataSnapshots.
54
54
* @param collection A FUICollection that the data source uses to pull snapshots
55
55
* from Firebase Database.
56
- * @param collectionView An instance of a UICollectionView to bind to. This view
56
+ * @param view An instance of a UICollectionView to bind to. This view
57
57
* is not retained by its data source.
58
58
* @param populateCell A closure used by the data source to create the cells that
59
59
* are displayed in the collection view. This closure is retained by the data
Original file line number Diff line number Diff line change 40
40
@property (nonatomic , readonly , copy ) NSArray *items;
41
41
42
42
/* *
43
- * Pass through of [FirebaseArray count] .
43
+ * The number of items in the receiver's collection .
44
44
*/
45
45
@property (nonatomic , readonly ) NSUInteger count;
46
46
47
+ /* *
48
+ * Takes an FUICollection and immediately starts observing it.
49
+ */
47
50
- (instancetype )initWithCollection : (id <FUICollection>)collection NS_DESIGNATED_INITIALIZER;
48
51
49
52
- (instancetype )init NS_UNAVAILABLE;
50
53
51
54
/* *
52
- * Pass through of [FirebaseArray snapshotAtIndex:] .
55
+ * Returns the snapshot at the given index in the receiver's collection .
53
56
*/
54
57
- (FIRDataSnapshot *)objectAtIndex : (NSUInteger )index ;
55
58
Original file line number Diff line number Diff line change @@ -28,16 +28,18 @@ NS_ASSUME_NONNULL_BEGIN
28
28
29
29
- (instancetype )init NS_UNAVAILABLE;
30
30
31
- - (instancetype )initWithQuery : (id <FUIDataObservable>)query
31
+ /* *
32
+ * Initializes a sorted collection.
33
+ * @param query The query the receiver uses to pull updates from Firebase Database.
34
+ * @param delegate The delegate object that should receive events from the array.
35
+ * @param sortDescriptor The closure used by the array to sort its contents. This
36
+ * block must always return consistent results or the array may raise a fatal error.
37
+ */
38
+ - (instancetype )initWithQuery : (id <FIRDataObservable>)query
32
39
delegate : (nullable id <FUICollectionDelegate>)delegate
33
40
sortDescriptor : (NSComparisonResult (^)(FIRDataSnapshot *left,
34
41
FIRDataSnapshot *right))sortDescriptor NS_DESIGNATED_INITIALIZER;
35
42
36
- - (void )observeQuery ;
37
- - (void )invalidate ;
38
-
39
- - (FIRDataSnapshot *)snapshotAtIndex : (NSInteger )index ;
40
-
41
43
@end
42
44
43
45
NS_ASSUME_NONNULL_END
You can’t perform that action at this time.
0 commit comments