Skip to content

Commit 5d9fe5e

Browse files
authored
Merge pull request #200 from danielpassos/update-readme
Fix FirebaseUI/Database README syntax
2 parents 921767a + 7e297bb commit 5d9fe5e

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

FirebaseDatabaseUI/README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ For a more in-depth explanation of each of the above, check the usage instructio
3535
self.dataSource = [self.tableView bindToQuery:self.firebaseRef
3636
populateCell:^UITableViewCell *(UITableView *tableView,
3737
NSIndexPath *indexPath,
38-
FIRDataSnapshot *object) {
38+
FIRDataSnapshot *snap) {
3939
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuseIdentifier"
4040
forIndexPath:indexPath];
4141
/* populate cell */
@@ -52,7 +52,7 @@ var dataSource: FUITableViewDataSource!
5252
5353
self.dataSource = self.tableView.bind(to: self.firebaseRef) { tableView, indexPath, snapshot in
5454
// Dequeue cell
55-
let cell = tableView.dequeueReusableCell(withReuseIdentifier: "reuseIdentifier", for: indexPath)
55+
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
5656
/* populate cell */
5757
return cell
5858
}
@@ -78,7 +78,7 @@ self.dataSource = [self.collectionView bindToQuery:self.firebaseRef
7878
populateCell:^UICollectionViewCell *(UICollectionView *collectionView,
7979
NSIndexPath *indexPath,
8080
FIRDataSnapshot *object) {
81-
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithIdentifier:@"reuseIdentfier"
81+
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"reuseIdentfier"
8282
forIndexPath:indexPath];
8383
/* populate cell */
8484
return cell;
@@ -89,7 +89,7 @@ self.dataSource = [self.collectionView bindToQuery:self.firebaseRef
8989
```swift
9090
// YourViewController.swift
9191
92-
self.dataSource = self.collectionView.bind(to: self.firebaseRef) { collectionView, indexPath, snap in
92+
self.dataSource = self.collectionView?.bind(to: self.firebaseRef) { collectionView, indexPath, snap in
9393
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "reuseIdentifier", for: indexPath)
9494
/* populate cell */
9595
return cell
@@ -106,10 +106,10 @@ You can use the default `UITableViewCell` or `UICollectionViewCell` implementati
106106

107107
#### Objective-C UITableView and UICollectionView with Default UI*ViewCell
108108
```objective-c
109-
self.dataSource = [self.tableView bindToQuery:firebaseRef
109+
self.dataSource = [self.tableView bindToQuery:self.firebaseRef
110110
populateCell:^UITableViewCell *(UITableView *tableView,
111111
NSIndexPath *indexPath,
112-
FIRDataSnapshot *object) {
112+
FIRDataSnapshot *snap) {
113113
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reuseIdentifier"
114114
forIndexPath:indexPath];
115115
// Populate cell as you see fit, like as below
@@ -119,30 +119,30 @@ self.dataSource = [self.tableView bindToQuery:firebaseRef
119119
```
120120
121121
```objective-c
122-
self.dataSource = [self.collectionView bindToQuery:firebaseRef
123-
populateCell:^UITableViewCell *(UICollectionView *collectionView,
122+
self.dataSource = [self.collectionView bindToQuery:self.firebaseRef
123+
populateCell:^UICollectionViewCell *(UICollectionView *collectionView,
124124
NSIndexPath *indexPath,
125-
FIRDataSnapshot *object) {
126-
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithIdentifier:@"reuseIdentifier"
125+
FIRDataSnapshot *snap) {
126+
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"reuseIdentifier"
127127
forIndexPath:indexPath];
128128
// Populate cell as you see fit by adding subviews as appropriate
129-
cell.contentView.addSubview(customView)
129+
[cell.contentView addSubview:customView];
130130
return cell;
131131
}];
132132
```
133133

134134
#### Swift UITableView and UICollectionView with Default UI*ViewCell
135135
```swift
136136
self.dataSource = self.tableView.bind(to: firebaseRef) { tableView, indexPath, snap in
137-
let cell = tableView.dequeueReusableCell(withReuseIdentifier: "reuseIdentifier", for: indexPath)
137+
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
138138
// Populate cell as you see fit, like as below
139-
cell.textLabel.text = snap.key
139+
cell.textLabel?.text = snap.key
140140
return cell
141141
}
142142
```
143143

144144
```swift
145-
self.dataSource = self.collectionView.bind(to: firebaseRef) { collectionView, indexPath, snap in
145+
self.dataSource = self.collectionView?.bind(to: firebaseRef) { collectionView, indexPath, snap in
146146
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "reuseIdentifier", for: indexPath)
147147
// Populate cell as you see fit by adding subviews as appropriate
148148
cell.contentView.addSubview(customView)
@@ -161,13 +161,13 @@ FirebaseUI has several building blocks that developers should understand before
161161
#### Objective-C
162162
```objective-c
163163
FIRDatabaseReference *firebaseRef = [[FIRDatabase database] reference];
164-
FUIArray *array = [[FUIArray alloc] initWithRef:firebaseRef];
164+
FUIArray *array = [[FUIArray alloc] initWithQuery:firebaseRef];
165165
```
166166
167167
#### Swift
168168
```swift
169169
let firebaseRef = FIRDatabase.database().reference()
170-
let array = FUIArray(ref: firebaseRef)
170+
let array = FUIArray(query: firebaseRef)
171171
```
172172

173173
### FUIDataSource

0 commit comments

Comments
 (0)