|
43 | 43 | */
|
44 | 44 | @property (strong, nonatomic, __NON_NULL) Class modelClass;
|
45 | 45 |
|
| 46 | +/** |
| 47 | + * The cell class to coerce UICollectionViewCells to (if desired). For instance, if the cellClass is set to [CustomCollectionViewCell class] in Obj-C or CustomCollectionViewCell in Swift, then objects of type CustomCollectionViewCell will be returned instead of type UICollectionViewCell. |
| 48 | + */ |
| 49 | +@property (strong, nonatomic, __NON_NULL) Class cellClass; |
| 50 | + |
46 | 51 | /**
|
47 | 52 | * The reuse identifier for cells in the UICollectionView.
|
48 | 53 | */
|
|
53 | 58 | */
|
54 | 59 | @property (strong, nonatomic, __NON_NULL) UICollectionView *collectionView;
|
55 | 60 |
|
| 61 | +/** |
| 62 | + * Property to keep track of prototype cell use, to not register a class for the UICollectionView or do similar book keeping. |
| 63 | + */ |
| 64 | +@property BOOL hasPrototypeCell; |
| 65 | + |
56 | 66 | /**
|
57 | 67 | * The callback to populate a subclass of UICollectionViewCell with an object provided by the datasource.
|
58 | 68 | */
|
59 |
| -@property (strong, nonatomic, __NON_NULL) void(^populateCell)(UICollectionViewCell * __NON_NULL_PTR cell, NSObject * __NON_NULL_PTR object); |
| 69 | +@property (strong, nonatomic, __NON_NULL) void(^populateCell)(__kindof UICollectionViewCell * __NON_NULL_PTR cell, __kindof NSObject * __NON_NULL_PTR object); |
60 | 70 |
|
61 | 71 | /**
|
62 | 72 | * Initialize an instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with FDataSnapshots.
|
|
65 | 75 | * @param collectionView An instance of a UICollectionView to bind to
|
66 | 76 | * @return An instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with FDataSnapshots
|
67 | 77 | */
|
68 |
| -- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
| 78 | +- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
| 79 | + |
| 80 | +/** |
| 81 | + * Initialize an instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with FDataSnapshots. Note that this method is used when using prototype cells, where the cells don't need to be registered in the class. |
| 82 | + * @param ref A Firebase reference to bind the datasource to |
| 83 | + * @param identifier A string to use as a CellReuseIdentifier |
| 84 | + * @param collectionView An instance of a UICollectionView to bind to |
| 85 | + * @return An instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with FDataSnapshots |
| 86 | + */ |
| 87 | +- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref prototypeReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
69 | 88 |
|
70 | 89 | /**
|
71 | 90 | * Initialize an instance of FirebaseCollectionViewDataSource that populates a custom subclass of UICollectionViewCell with FDataSnapshots.
|
|
75 | 94 | * @param collectionView An instance of a UICollectionView to bind to
|
76 | 95 | * @return An instance of FirebaseCollectionViewDataSource that populates a custom subclass of UICollectionViewCell with FDataSnapshots
|
77 | 96 | */
|
78 |
| -- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellClass:(__NULLABLE Class)cell reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
| 97 | +- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref cellClass:(__NULLABLE Class)cell cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
79 | 98 |
|
80 | 99 | /**
|
81 | 100 | * Initialize an instance of FirebaseCollectionViewDataSource that populates a custom xib with FDataSnapshots.
|
|
85 | 104 | * @param collectionView An instance of a UICollectionView to bind to
|
86 | 105 | * @return An instance of FirebaseCollectionViewDataSource that populates a custom xib with FDataSnapshots
|
87 | 106 | */
|
88 |
| -- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref nibNamed:(__NON_NULL NSString *)nibName reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
| 107 | +- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref nibNamed:(__NON_NULL NSString *)nibName cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
89 | 108 |
|
90 | 109 | /**
|
91 | 110 | * Initialize an instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with a custom model class.
|
|
95 | 114 | * @param collectionView An instance of a UICollectionView to bind to
|
96 | 115 | * @return An instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with a custom model class
|
97 | 116 | */
|
98 |
| -- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
| 117 | +- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
| 118 | + |
| 119 | +/** |
| 120 | + * Initialize an instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells 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. |
| 121 | + * @param ref A Firebase reference to bind the datasource to |
| 122 | + * @param model A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil |
| 123 | + * @param identifier A string to use as a CellReuseIdentifier |
| 124 | + * @param collectionView An instance of a UICollectionView to bind to |
| 125 | + * @return An instance of FirebaseCollectionViewDataSource that populates UICollectionViewCells with a custom model class |
| 126 | + */ |
| 127 | +- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model prototypeReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
99 | 128 |
|
100 | 129 | /**
|
101 | 130 | * Initialize an instance of FirebaseCollectionViewDataSource that populates a custom subclass of UICollectionViewCell with a custom model class.
|
|
106 | 135 | * @param collectionView An instance of a UICollectionView to bind to
|
107 | 136 | * @return An instance of FirebaseCollectionViewDataSource that populates a custom subclass of UICollectionViewCell with a custom model class
|
108 | 137 | */
|
109 |
| -- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellClass:(__NULLABLE Class)cell reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
| 138 | +- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model cellClass:(__NULLABLE Class)cell cellReuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
110 | 139 |
|
111 | 140 | /**
|
112 | 141 | * Initialize an instance of FirebaseCollectionViewDataSource that populates a custom xib with a custom model class.
|
|
117 | 146 | * @param collectionView An instance of a UICollectionView to bind to
|
118 | 147 | * @return An instance of FirebaseCollectionViewDataSource that populates a custom xib with a custom model class
|
119 | 148 | */
|
120 |
| -- (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref modelClass:(__NULLABLE Class)model nibNamed:(__NON_NULL NSString *)nibName reuseIdentifier:(__NON_NULL NSString *)identifier view:(__NON_NULL UICollectionView *)collectionView; |
| 149 | +- (__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 UICollectionView *)collectionView; |
121 | 150 |
|
122 | 151 | /**
|
123 | 152 | * This method populates the fields of a UICollectionViewCell or subclass given an FDataSnapshot (or custom model object).
|
124 | 153 | * @param callback A block which returns an initialized UICollectionViewCell (or subclass) and the corresponding object to populate the cell with.
|
125 | 154 | */
|
126 |
| -- (void)populateCellWithBlock:(__NON_NULL void(^)(UICollectionViewCell * __NON_NULL_PTR cell, NSObject * __NON_NULL_PTR object))callback; |
| 155 | +- (void)populateCellWithBlock:(__NON_NULL void(^)(__kindof UICollectionViewCell * __NON_NULL_PTR cell, __kindof NSObject * __NON_NULL_PTR object))callback; |
127 | 156 |
|
128 | 157 | @end
|
0 commit comments