|
| 1 | +// clang-format off |
| 2 | + |
1 | 3 | /* |
2 | 4 | * Firebase UI Bindings iOS Library |
3 | 5 | * |
|
26 | 28 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 29 | */ |
28 | 30 |
|
| 31 | +// clang-format on |
| 32 | + |
29 | 33 | #import <UIKit/UIKit.h> |
30 | 34 | #import <FirebaseUI/XCodeMacros.h> |
31 | 35 |
|
|
34 | 38 | @class Firebase; |
35 | 39 |
|
36 | 40 | /** |
37 | | - * FirebaseTableViewDataSource provides an class that conforms to the UITableViewDataSource protocol |
38 | | - * which allows UITableViews to implement FirebaseTableViewDataSource in order to provide a |
39 | | - * UITableView synchronized to a Firebase reference or query. In addition to handling all Firebase |
40 | | - * child events (added, changed, removed, moved), FirebaseTableViewDataSource handles |
41 | | - * UITableViewCell creation, either with the default UITableViewCell, prototype cells, custom |
42 | | - * UITableViewCell subclasses, or custom XIBs, and provides a simple [FirebaseTableViewDataSource |
43 | | - * populateCellWithBlock:] method which allows developers to populate the cells created for them |
| 41 | + * FirebaseTableViewDataSource provides an class that conforms to the |
| 42 | + * UITableViewDataSource protocol |
| 43 | + * which allows UITableViews to implement FirebaseTableViewDataSource in order |
| 44 | + * to provide a |
| 45 | + * UITableView synchronized to a Firebase reference or query. In addition to |
| 46 | + * handling all Firebase |
| 47 | + * child events (added, changed, removed, moved), FirebaseTableViewDataSource |
| 48 | + * handles |
| 49 | + * UITableViewCell creation, either with the default UITableViewCell, prototype |
| 50 | + * cells, custom |
| 51 | + * UITableViewCell subclasses, or custom XIBs, and provides a simple |
| 52 | + * [FirebaseTableViewDataSource |
| 53 | + * populateCellWithBlock:] method which allows developers to populate the cells |
| 54 | + * created for them |
44 | 55 | * with desired data from Firebase. |
45 | 56 | */ |
46 | | -@interface FirebaseTableViewDataSource : FirebaseDataSource<UITableViewDataSource> |
| 57 | +@interface FirebaseTableViewDataSource |
| 58 | + : FirebaseDataSource<UITableViewDataSource> |
47 | 59 |
|
48 | 60 | /** |
49 | | - * The model class to coerce FDataSnapshots to (if desired). For instance, if the modelClass is set |
50 | | - * to [Message class] in Obj-C or Message.self in Swift, then objects of type Message will be |
| 61 | + * The model class to coerce FDataSnapshots to (if desired). For instance, if |
| 62 | + * the modelClass is set |
| 63 | + * to [Message class] in Obj-C or Message.self in Swift, then objects of type |
| 64 | + * Message will be |
51 | 65 | * returned instead of type FDataSnapshot. |
52 | 66 | */ |
53 | 67 | @property(strong, nonatomic, __NON_NULL) Class modelClass; |
|
58 | 72 | @property(strong, nonatomic, __NON_NULL) NSString *reuseIdentifier; |
59 | 73 |
|
60 | 74 | /** |
61 | | - * The UITableView instance that operations (inserts, removals, moves, etc.) are performed against. |
| 75 | + * The UITableView instance that operations (inserts, removals, moves, etc.) are |
| 76 | + * performed against. |
62 | 77 | */ |
63 | 78 | @property(strong, nonatomic, __NON_NULL) UITableView *tableView; |
64 | 79 |
|
65 | 80 | /** |
66 | | - * Property to keep track of prototype cell use, to not register a class for the UICollectionView or |
| 81 | + * Property to keep track of prototype cell use, to not register a class for the |
| 82 | + * UICollectionView or |
67 | 83 | * do similar book keeping. |
68 | 84 | */ |
69 | 85 | @property BOOL hasPrototypeCell; |
70 | 86 |
|
71 | 87 | /** |
72 | | - * The callback to populate a subclass of UITableViewCell with an object provided by the datasource. |
| 88 | + * The callback to populate a subclass of UITableViewCell with an object |
| 89 | + * provided by the datasource. |
73 | 90 | */ |
74 | 91 | @property(strong, nonatomic, __NON_NULL) void (^populateCell) |
75 | | - (__KINDOF UITableViewCell *__NON_NULL_PTR cell, __KINDOF NSObject *__NON_NULL_PTR object); |
| 92 | + (__KINDOF(UITableViewCell *) __NON_NULL_PTR cell, |
| 93 | + __KINDOF(NSObject *) __NON_NULL_PTR object); |
76 | 94 |
|
77 | 95 | /** |
78 | | - * Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with |
| 96 | + * Initialize an instance of FirebaseTableViewDataSource that populates |
| 97 | + * UITableViewCells with |
79 | 98 | * FDataSnapshots. |
80 | 99 | * @param ref A Firebase reference to bind the datasource to |
81 | 100 | * @param identifier A string to use as a CellReuseIdentifier |
82 | 101 | * @param tableView An instance of a UITableView to bind to |
83 | | - * @return An instance of FirebaseTableViewDataSource that populates UITableViewCells with |
| 102 | + * @return An instance of FirebaseTableViewDataSource that populates |
| 103 | + * UITableViewCells with |
84 | 104 | * FDataSnapshots |
85 | 105 | */ |
86 | 106 | - (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref |
87 | 107 | cellReuseIdentifier:(__NON_NULL NSString *)identifier |
88 | 108 | view:(__NON_NULL UITableView *)tableView; |
89 | 109 |
|
90 | 110 | /** |
91 | | - * Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with |
92 | | - * FDataSnapshots. Note that this method is used when using prototype cells, where the cells don't |
| 111 | + * Initialize an instance of FirebaseTableViewDataSource that populates |
| 112 | + * UITableViewCells with |
| 113 | + * FDataSnapshots. Note that this method is used when using prototype cells, |
| 114 | + * where the cells don't |
93 | 115 | * need to be registered in the class. |
94 | 116 | * @param ref A Firebase reference to bind the datasource to |
95 | 117 | * @param identifier A string to use as a CellReuseIdentifier |
96 | 118 | * @param tableView An instance of a UITableView to bind to |
97 | | - * @return An instance of FirebaseTableViewDataSource that populates UITableViewCells with |
| 119 | + * @return An instance of FirebaseTableViewDataSource that populates |
| 120 | + * UITableViewCells with |
98 | 121 | * FDataSnapshots |
99 | 122 | */ |
100 | 123 | - (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref |
101 | 124 | prototypeReuseIdentifier:(__NON_NULL NSString *)identifier |
102 | 125 | view:(__NON_NULL UITableView *)tableView; |
103 | 126 |
|
104 | 127 | /** |
105 | | - * Initialize an instance of FirebaseTableViewDataSource that populates a custom subclass of |
| 128 | + * Initialize an instance of FirebaseTableViewDataSource that populates a custom |
| 129 | + * subclass of |
106 | 130 | * UITableViewCell with FDataSnapshots. |
107 | 131 | * @param ref A Firebase reference to bind the datasource to |
108 | | - * @param cell A subclass of UITableViewCell used to populate the UITableView, defaults to |
| 132 | + * @param cell A subclass of UITableViewCell used to populate the UITableView, |
| 133 | + * defaults to |
109 | 134 | * UITableViewCell if nil |
110 | 135 | * @param identifier A string to use as a CellReuseIdentifier |
111 | 136 | * @param tableView An instance of a UITableView to bind to |
112 | | - * @return An instance of FirebaseTableViewDataSource that populates a custom subclass of |
| 137 | + * @return An instance of FirebaseTableViewDataSource that populates a custom |
| 138 | + * subclass of |
113 | 139 | * UITableViewCell with FDataSnapshots |
114 | 140 | */ |
115 | 141 | - (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref |
|
118 | 144 | view:(__NON_NULL UITableView *)tableView; |
119 | 145 |
|
120 | 146 | /** |
121 | | - * Initialize an instance of FirebaseTableViewDataSource that populates a custom xib with |
| 147 | + * Initialize an instance of FirebaseTableViewDataSource that populates a custom |
| 148 | + * xib with |
122 | 149 | * FDataSnapshots. |
123 | 150 | * @param ref A Firebase reference to bind the datasource to |
124 | | - * @param nibName The name of a xib file to create the layout for a UITableViewCell |
| 151 | + * @param nibName The name of a xib file to create the layout for a |
| 152 | + * UITableViewCell |
125 | 153 | * @param identifier A string to use as a CellReuseIdentifier |
126 | 154 | * @param tableView An instance of a UITableView to bind to |
127 | | - * @return An instance of FirebaseTableViewDataSource that populates a custom xib with |
| 155 | + * @return An instance of FirebaseTableViewDataSource that populates a custom |
| 156 | + * xib with |
128 | 157 | * FDataSnapshots |
129 | 158 | */ |
130 | 159 | - (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref |
|
133 | 162 | view:(__NON_NULL UITableView *)tableView; |
134 | 163 |
|
135 | 164 | /** |
136 | | - * Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with a |
| 165 | + * Initialize an instance of FirebaseTableViewDataSource that populates |
| 166 | + * UITableViewCells with a |
137 | 167 | * custom model class. |
138 | 168 | * @param ref A Firebase reference to bind the datasource to |
139 | | - * @param model A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil |
| 169 | + * @param model A custom class that FDataSnapshots are coerced to, defaults to |
| 170 | + * FDataSnapshot if nil |
140 | 171 | * @param identifier A string to use as a CellReuseIdentifier |
141 | 172 | * @param tableView An instance of a UITableView to bind to |
142 | | - * @return An instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom |
| 173 | + * @return An instance of FirebaseTableViewDataSource that populates |
| 174 | + * UITableViewCells with a custom |
143 | 175 | * model class |
144 | 176 | */ |
145 | 177 | - (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref |
|
148 | 180 | view:(__NON_NULL UITableView *)tableView; |
149 | 181 |
|
150 | 182 | /** |
151 | | - * Initialize an instance of FirebaseTableViewDataSource that populates UITableViewCells with a |
152 | | - * custom model class. Note that this method is used when using prototype cells, where the cells |
| 183 | + * Initialize an instance of FirebaseTableViewDataSource that populates |
| 184 | + * UITableViewCells with a |
| 185 | + * custom model class. Note that this method is used when using prototype cells, |
| 186 | + * where the cells |
153 | 187 | * don't need to be registered in the class. |
154 | 188 | * @param ref A Firebase reference to bind the datasource to |
155 | | - * @param model A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil |
| 189 | + * @param model A custom class that FDataSnapshots are coerced to, defaults to |
| 190 | + * FDataSnapshot if nil |
156 | 191 | * @param identifier A string to use as a CellReuseIdentifier |
157 | 192 | * @param tableView An instance of a UITableView to bind to |
158 | | - * @return An instance of FirebaseTableViewDataSource that populates UITableViewCells with a custom |
| 193 | + * @return An instance of FirebaseTableViewDataSource that populates |
| 194 | + * UITableViewCells with a custom |
159 | 195 | * model class |
160 | 196 | */ |
161 | 197 | - (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref |
|
164 | 200 | view:(__NON_NULL UITableView *)tableView; |
165 | 201 |
|
166 | 202 | /** |
167 | | - * Initialize an instance of FirebaseTableViewDataSource that populates a custom subclass of |
| 203 | + * Initialize an instance of FirebaseTableViewDataSource that populates a custom |
| 204 | + * subclass of |
168 | 205 | * UITableViewCell with a custom model class. |
169 | 206 | * @param ref A Firebase reference to bind the datasource to |
170 | | - * @param model A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil |
171 | | - * @param cell A subclass of UITableViewCell used to populate the UITableView, defaults to |
| 207 | + * @param model A custom class that FDataSnapshots are coerced to, defaults to |
| 208 | + * FDataSnapshot if nil |
| 209 | + * @param cell A subclass of UITableViewCell used to populate the UITableView, |
| 210 | + * defaults to |
172 | 211 | * UITableViewCell if nil |
173 | 212 | * @param identifier A string to use as a CellReuseIdentifier |
174 | 213 | * @param tableView An instance of a UITableView to bind to |
175 | | - * @return An instance of FirebaseTableViewDataSource that populates a custom subclass of |
| 214 | + * @return An instance of FirebaseTableViewDataSource that populates a custom |
| 215 | + * subclass of |
176 | 216 | * UITableViewCell with a custom model class |
177 | 217 | */ |
178 | 218 | - (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref |
|
182 | 222 | view:(__NON_NULL UITableView *)tableView; |
183 | 223 |
|
184 | 224 | /** |
185 | | - * Initialize an instance of FirebaseTableViewDataSource that populates a custom xib with a custom |
| 225 | + * Initialize an instance of FirebaseTableViewDataSource that populates a custom |
| 226 | + * xib with a custom |
186 | 227 | * model class. |
187 | 228 | * @param ref A Firebase reference to bind the datasource to |
188 | | - * @param model A custom class that FDataSnapshots are coerced to, defaults to FDataSnapshot if nil |
189 | | - * @param nibName The name of a xib file to create the layout for a UITableViewCell |
| 229 | + * @param model A custom class that FDataSnapshots are coerced to, defaults to |
| 230 | + * FDataSnapshot if nil |
| 231 | + * @param nibName The name of a xib file to create the layout for a |
| 232 | + * UITableViewCell |
190 | 233 | * @param identifier A string to use as a CellReuseIdentifier |
191 | 234 | * @param tableView An instance of a UITableView to bind to |
192 | | - * @return An instance of FirebaseTableViewDataSource that populates a custom xib with a custom |
| 235 | + * @return An instance of FirebaseTableViewDataSource that populates a custom |
| 236 | + * xib with a custom |
193 | 237 | * model class |
194 | 238 | */ |
195 | 239 | - (__NON_NULL instancetype)initWithRef:(__NON_NULL Firebase *)ref |
|
199 | 243 | view:(__NON_NULL UITableView *)tableView; |
200 | 244 |
|
201 | 245 | /** |
202 | | - * This method populates the fields of a UITableViewCell or subclass given a model object (or |
| 246 | + * This method populates the fields of a UITableViewCell or subclass given a |
| 247 | + * model object (or |
203 | 248 | * FDataSnapshot). |
204 | | - * @param callback A block which returns an initialized UITableViewCell (or subclass) and the |
| 249 | + * @param callback A block which returns an initialized UITableViewCell (or |
| 250 | + * subclass) and the |
205 | 251 | * corresponding object to populate the cell with. |
206 | 252 | */ |
207 | | -- (void)populateCellWithBlock:(nonnull void (^)(__KINDOF UITableViewCell *__NON_NULL_PTR cell, |
208 | | - __KINDOF NSObject *__NON_NULL_PTR object))callback; |
| 253 | +// clang-format off |
| 254 | +- (void)populateCellWithBlock: |
| 255 | + (nonnull void (^)(__KINDOF(UITableViewCell *)__NON_NULL_PTR cell, |
| 256 | + __KINDOF(NSObject *)__NON_NULL_PTR object))callback; |
| 257 | +// clang-format on |
209 | 258 |
|
210 | 259 | @end |
0 commit comments