Skip to content

Commit 646c6fe

Browse files
committed
Updating reuseID info in docs
1 parent 79884c1 commit 646c6fe

File tree

1 file changed

+31
-29
lines changed

1 file changed

+31
-29
lines changed

README.md

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ YourViewController.h
5858
```objective-c
5959
YourViewController.m
6060
...
61-
self.firebaseRef = [[Firebase alloc] initWithUrl:@"https://<your-firebase-app>.firebaseio.com/"];
62-
self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef reuseIdentifier:@"<your-reuse-identifier>" view:self.tableView];
61+
self.firebaseRef = [[Firebase alloc] initWithUrl:@"https://<YOUR-FIREBASE-APP>.firebaseio.com/"];
62+
self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef cellReuseIdentifier:@"<YOUR-REUSE-IDENTIFIER>" view:self.tableView];
6363

6464
[self.dataSource populateCellWithBlock:^(UITableViewCell *cell, FDataSnapshot *snap) {
6565
// Populate cell as you see fit, like as below
@@ -73,10 +73,10 @@ self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef r
7373
```swift
7474
YourViewController.swift
7575
...
76-
let firebaseRef = Firebase(url:"https://<your-firebase-app>.firebaseio.com/")
76+
let firebaseRef = Firebase(url:"https://<YOUR-FIREBASE-APP>.firebaseio.com/")
7777
let dataSource: FirebaseTableViewDataSource!
7878
...
79-
self.dataSource = FirebaseTableViewDataSource(ref: self.firebaseRef, reuseIdentifier: "<your-reuse-identifier>", view: self.tableView)
79+
self.dataSource = FirebaseTableViewDataSource(ref: self.firebaseRef, cellReuseIdentifier: "<YOUR-REUSE-IDENTIFIER>", view: self.tableView)
8080
8181
self.dataSource.populateCellWithBlock { (cell: UITableViewCell, obj: NSObject) -> Void in
8282
let snap = obj as! FDataSnapshot
@@ -104,8 +104,8 @@ YourViewController.h
104104
```objective-c
105105
YourViewController.m
106106
...
107-
self.firebaseRef = [[Firebase alloc] initWithUrl:@"https://<your-firebase-app>.firebaseio.com/"];
108-
self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef reuseIdentifier:@"<your-reuse-identifier>" view:self.CollectionView];
107+
self.firebaseRef = [[Firebase alloc] initWithUrl:@"https://<YOUR-FIREBASE-APP>.firebaseio.com/"];
108+
self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef cellReuseIdentifier:@"<YOUR-REUSE-IDENTIFIER>" view:self.CollectionView];
109109

110110
[self.dataSource populateCellWithBlock:^(UICollectionViewCell *cell, FDataSnapshot *snap) {
111111
// Populate cell as you see fit, like as below
@@ -119,10 +119,10 @@ self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef r
119119
```swift
120120
YourViewController.swift
121121
...
122-
let firebaseRef = Firebase(url: "https://<your-firebase-app>.firebaseio.com/")
122+
let firebaseRef = Firebase(url: "https://<YOUR-FIREBASE-APP>.firebaseio.com/")
123123
let dataSource: FirebaseCollectionViewDataSource!
124124
...
125-
self.dataSource = FirebaseCollectionViewDataSource(ref: self.firebaseRef, reuseIdentifier: "<your-reuse-identifier>", view: self.collectionView)
125+
self.dataSource = FirebaseCollectionViewDataSource(ref: self.firebaseRef, cellReuseIdentifier: "<YOUR-REUSE-IDENTIFIER>", view: self.collectionView)
126126
127127
self.dataSource.populateCellWithBlock { (cell: UICollectionViewCell, obj: NSObject) -> Void in
128128
let snap = obj as! FDataSnapshot
@@ -145,7 +145,7 @@ You can use the default `UITableViewCell` or `UICollectionViewCell` implementati
145145

146146
#### Objective-C UITableView and UICollectionView with Default UI*ViewCell
147147
```objective-c
148-
self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef reuseIdentifier:@"<your-reuse-identifier>" view:self.tableView];
148+
self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef cellReuseIdentifier:@"<YOUR-REUSE-IDENTIFIER>" view:self.tableView];
149149

150150
[self.dataSource populateCellWithBlock:^(UITableViewCell *cell, FDataSnapshot *snap) {
151151
// Populate cell as you see fit, like as below
@@ -156,7 +156,7 @@ self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef r
156156
```
157157
158158
```objective-c
159-
self.dataSource = [[FirebaseCollectioneViewDataSource alloc] initWithRef:firebaseRef reuseIdentifier:@"<your-reuse-identifier>" view:self.CollectionView];
159+
self.dataSource = [[FirebaseCollectioneViewDataSource alloc] initWithRef:firebaseRef cellReuseIdentifier:@"<YOUR-REUSE-IDENTIFIER>" view:self.CollectionView];
160160
161161
[self.dataSource populateCellWithBlock:^(UICollectionViewCell *cell, FDataSnapshot *snap) {
162162
// Populate cell as you see fit by adding subviews as appropriate
@@ -168,7 +168,7 @@ self.dataSource = [[FirebaseCollectioneViewDataSource alloc] initWithRef:firebas
168168

169169
#### Swift UITableView and UICollectionView with Default UI*ViewCell
170170
```swift
171-
self.dataSource = FirebaseTableViewDataSource(ref: firebaseRef reuseIdentifier: @"<your-reuse-identifier>" view: self.tableView)
171+
self.dataSource = FirebaseTableViewDataSource(ref: firebaseRef cellReuseIdentifier: @"<YOUR-REUSE-IDENTIFIER>" view: self.tableView)
172172

173173
self.dataSource.populateCellWithBlock { (cell: UITableViewCell, obj: NSObject) -> Void in
174174
// Populate cell as you see fit, like as below
@@ -179,7 +179,7 @@ self.tableView.dataSource = self.dataSource;
179179
```
180180

181181
```swift
182-
self.dataSource = FirebaseCollectionViewDataSource(ref: firebaseRef reuseIdentifier: @"<your-reuse-identifier>" view: self.collectionView)
182+
self.dataSource = FirebaseCollectionViewDataSource(ref: firebaseRef cellReuseIdentifier: @"<YOUR-REUSE-IDENTIFIER>" view: self.collectionView)
183183

184184
self.dataSource.populateCellWithBlock { (cell: UICollectionViewCell, obj: NSObject) -> Void in
185185
// Populate cell as you see fit by adding subviews as appropriate
@@ -191,15 +191,17 @@ self.collectionView.dataSource = self.dataSource;
191191

192192
### Using Storyboards and Prototype Cells
193193

194-
Create a storyboard that has either a `UITableViewController`, `UICollectionViewController` or a `UIViewController` with a `UITableView` or `UICollectionView`. Drag a prototype cell onto the `UITableView` or `UICollectionView` and give it a custom reuse identifier which matches the reuse identifier being used when instantiating the `Firebase*ViewDataSource`. Drag and other properties onto the cell and associate them with properties of a `UITableViewCell` or `UICollectionViewCell` subclass. Code samples are similar to the above.
194+
Create a storyboard that has either a `UITableViewController`, `UICollectionViewController` or a `UIViewController` with a `UITableView` or `UICollectionView`. Drag a prototype cell onto the `UITableView` or `UICollectionView` and give it a custom reuse identifier which matches the reuse identifier being used when instantiating the `Firebase*ViewDataSource`. When using prototype cells, make sure to use `prototypeReuseIdentifier` instead of `cellReuseIdentifier`.
195+
196+
Drag and other properties onto the cell and associate them with properties of a `UITableViewCell` or `UICollectionViewCell` subclass. Code samples are otherwise similar to the above.
195197

196198
### Using a Custom Subclass of UI*ViewCell
197199

198200
Create a custom subclass of `UITableViewCell` or `UICollectionViewCell`, with or without the XIB file. Make sure to instantiate `-initWithStyle: reuseIdentifier:` to instantiate a `UITableViewCell` or `-initWithFrame:` to instantiate a `UICollectionViewCell`. You can then hook the custom class up to the implementation of `FirebaseTableViewDataSource`.
199201

200202
#### Objective-C UITableView and UICollectionView with Custom Subclasses of UI*ViewCell
201203
```objective-c
202-
self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef cellClass:[YourCustomClass class] reuseIdentifier:@"<your-reuse-identifier>" view:self.tableView];
204+
self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef cellClass:[YourCustomClass class] cellReuseIdentifier:@"<YOUR-REUSE-IDENTIFIER>" view:self.tableView];
203205

204206
[self.dataSource populateCellWithBlock:^(YourCustomClass *cell, FDataSnapshot *snap) {
205207
// Populate custom cell as you see fit, like as below
@@ -210,7 +212,7 @@ self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef c
210212
```
211213
212214
```objective-c
213-
self.dataSource = [[FirebaseCollectioneViewDataSource alloc] initWithRef:firebaseRef cellClass:[YourCustomClass class] reuseIdentifier:@"<your-reuse-identifier>" view:self.CollectionView];
215+
self.dataSource = [[FirebaseCollectioneViewDataSource alloc] initWithRef:firebaseRef cellClass:[YourCustomClass class] cellReuseIdentifier:@"<YOUR-REUSE-IDENTIFIER>" view:self.CollectionView];
214216
215217
[self.dataSource populateCellWithBlock:^(YourCustomClass *cell, FDataSnapshot *snap) {
216218
// Populate cell as you see fit
@@ -222,7 +224,7 @@ self.dataSource = [[FirebaseCollectioneViewDataSource alloc] initWithRef:firebas
222224

223225
#### Swift UITableView and UICollectionView with Custom Subclasses of UI*ViewCell
224226
```swift
225-
self.dataSource = FirebaseTableViewDataSource(ref: firebaseRef cellClass: YourCustomClass.self reuseIdentifier: @"<your-reuse-identifier>" view: self.tableView)
227+
self.dataSource = FirebaseTableViewDataSource(ref: firebaseRef cellClass: YourCustomClass.self cellReuseIdentifier: @"<YOUR-REUSE-IDENTIFIER>" view: self.tableView)
226228

227229
self.dataSource.populateCellWithBlock { (cell: YourCustomClass, obj: NSObject) -> Void in
228230
// Populate cell as you see fit, like as below
@@ -233,7 +235,7 @@ self.tableView.dataSource = self.dataSource;
233235
```
234236

235237
```swift
236-
self.dataSource = FirebaseCollectionViewDataSource(ref: firebaseRef cellClass: YourCustomClass.self reuseIdentifier: @"<your-reuse-identifier>" view: self.collectionView)
238+
self.dataSource = FirebaseCollectionViewDataSource(ref: firebaseRef cellClass: YourCustomClass.self cellReuseIdentifier: @"<YOUR-REUSE-IDENTIFIER>" view: self.collectionView)
237239

238240
self.dataSource.populateCellWithBlock { (cell: YourCustomClass, obj: NSObject) -> Void in
239241
// Populate cell as you see fit
@@ -249,23 +251,23 @@ Create a custom XIB file and hook it up to the prototype cell. You can then use
249251

250252
#### Objective-C UITableView and UICollectionView with Custom XIB
251253
```objective-c
252-
self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef nibNamed:@"<your-xib>" reuseIdentifier:@"<your-reuse-identifier>" view:self.tableView];
254+
self.dataSource = [[FirebaseTableViewDataSource alloc] initWithRef:firebaseRef nibNamed:@"<YOUR-XIB>" cellReuseIdentifier:@"<YOUR-REUSE-IDENTIFIER>" view:self.tableView];
253255

254256
[self.dataSource populateCellWithBlock:^(UITableViewCell *cell, FDataSnapshot *snap) {
255257
// Use tags to populate custom properties, or use properties of a custom cell, if applicable
256-
UILabel *yourCustomLabel = (UILabel *)[cell.contentView viewWithTag:<your-tag>];
258+
UILabel *yourCustomLabel = (UILabel *)[cell.contentView viewWithTag:<YOUR-TAG>];
257259
yourCustomLabel.text = snap.key
258260
}];
259261

260262
[self.tableView setDataSource:self.dataSource];
261263
```
262264
263265
```objective-c
264-
self.dataSource = [[FirebaseCollectionViewDataSource alloc] initWithRef:firebaseRef nibNamed:@"<your-xib>" reuseIdentifier:@"<your-reuse-identifier>" view:self.collectionView];
266+
self.dataSource = [[FirebaseCollectionViewDataSource alloc] initWithRef:firebaseRef nibNamed:@"<YOUR-XIB>" cellReuseIdentifier:@"<YOUR-REUSE-IDENTIFIER>" view:self.collectionView];
265267
266268
[self.dataSource populateCellWithBlock:^(UICollectionViewCell *cell, FDataSnapshot *snap) {
267269
// Use tags to populate custom properties, or use properties of a custom cell, if applicable
268-
UILabel *yourCustomLabel = (UILabel *)[cell.contentView viewWithTag:<your-tag>];
270+
UILabel *yourCustomLabel = (UILabel *)[cell.contentView viewWithTag:<YOUR-TAG>];
269271
yourCustomLabel.text = snap.key
270272
}];
271273
@@ -274,23 +276,23 @@ self.dataSource = [[FirebaseCollectionViewDataSource alloc] initWithRef:firebase
274276

275277
#### Swift UITableView and UICollectionView with Custom XIB
276278
```swift
277-
self.dataSource = FirebaseTableViewDataSource(ref: firebaseRef nibNamed: "<your-xib>" reuseIdentifier: @"<your-reuse-identifier>" view: self.tableView)
279+
self.dataSource = FirebaseTableViewDataSource(ref: firebaseRef nibNamed: "<YOUR-XIB>" cellReuseIdentifier: @"<YOUR-REUSE-IDENTIFIER>" view: self.tableView)
278280

279281
self.dataSource.populateCellWithBlock { (cell: UITableViewCell, obj: NSObject) -> Void in
280282
// Use tags to populate custom properties, or use properties of a custom cell, if applicable
281-
let yourCustomLabel: UILabel = cell.contentView.viewWithTag(<your-tag>) as! UILabel
283+
let yourCustomLabel: UILabel = cell.contentView.viewWithTag(<YOUR-TAG>) as! UILabel
282284
yourCustomLabel.text = snap.key
283285
}
284286

285287
self.tableView.dataSource = self.dataSource;
286288
```
287289

288290
```swift
289-
self.dataSource = FirebaseCollectionViewDataSource(ref: firebaseRef cellClass: YourCustomClass.self reuseIdentifier: @"<your-reuse-identifier>" view: self.collectionView)
291+
self.dataSource = FirebaseCollectionViewDataSource(ref: firebaseRef cellClass: YourCustomClass.self cellReuseIdentifier: @"<YOUR-REUSE-IDENTIFIER>" view: self.collectionView)
290292

291293
self.dataSource.populateCellWithBlock { (cell: YourCustomClass, obj: NSObject) -> Void in
292294
// Use tags to populate custom properties, or use properties of a custom cell, if applicable
293-
let yourCustomLabel: UILabel = cell.contentView.viewWithTag(<your-tag>) as! UILabel
295+
let yourCustomLabel: UILabel = cell.contentView.viewWithTag(<YOUR-TAG>) as! UILabel
294296
yourCustomLabel.text = snap.key
295297
}
296298

@@ -307,13 +309,13 @@ FirebaseUI has several building blocks that developers should understand before
307309

308310
#### Objective-C
309311
```objective-c
310-
Firebase *firebaseRef = [[Firebase alloc] initWithUrl:@"https://<your-firebase-app>.firebaseio.com/"];
312+
Firebase *firebaseRef = [[Firebase alloc] initWithUrl:@"https://<YOUR-FIREBASE-APP>.firebaseio.com/"];
311313
FirebaseArray *array = [[FirebaseArray alloc] initWithRef:firebaseRef];
312314
```
313315
314316
#### Swift
315317
```swift
316-
let firebaseRef = Firebase(url: "https://<your-firebase-app>.firebaseio.com/")
318+
let firebaseRef = Firebase(url: "https://<YOUR-FIREBASE-APP>.firebaseio.com/")
317319
let array = FirebaseArray(ref: firebaseRef)
318320
```
319321

@@ -332,7 +334,7 @@ $ cd FirebaseUI-iOS
332334
$ ./setup.sh
333335
```
334336

335-
FirebaseUI makes use of XCode 7 features such as lightweight generics and `__kindof` annotations, so please ensure you're using the latest version of XCode beta for development.
337+
FirebaseUI makes use of XCode 7 features such as lightweight generics and `__kindof` annotations, but it should be backwards compatible to XCode 6 thanks to [XCodeMacros.h](https://github.com/firebase/FirebaseUI-iOS/blob/master/FirebaseUI/XCodeMacros.h).
336338

337339
## Deployment
338340

@@ -374,4 +376,4 @@ accept your pull requests.
374376
1. Ensure that your code adheres to the existing style of the library to which
375377
you are contributing.
376378
1. Ensure that your code has an appropriate set of unit tests which all pass.
377-
1. Submit a pull request.
379+
1. Submit a pull request and cc @davideast or @mcdonamp

0 commit comments

Comments
 (0)