You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: FirebaseDatabaseUI/README.md
+14-40Lines changed: 14 additions & 40 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
FirebaseUI Database allows you to quickly connect common UI elements to the [Firebase Realtime Database](https://firebase.google.com/docs/database?utm_source=firebaseui-ios) for data storage, allowing views to be updated in realtime as they change, and providing simple interfaces for common tasks like displaying lists or collections of items.
4
4
5
5
## FirebaseUI Database
6
-
Provides core data binding capabilities as well as specific datasources for lists of data. Skip to the [Core API overview](https://github.com/firebase/firebaseui-ios#firebaseui-core-api) for more information.
6
+
Provides core data binding capabilities as well as specific data sources for lists of data.
@@ -12,23 +12,19 @@ FUICollectionViewDataSource | Data source to bind a Firebase query to a UIC
12
12
FUIIndexCollectionViewDataSource | Data source to populate a collection view with indexed data from Firebase DB.
13
13
FUIIndexTableViewDataSource | Data source to populate a table view with indexed data from Firebase DB.
14
14
FUIArray | Keeps an array synchronized to a Firebase query
15
+
FUISortedArray | A synchronized array that automatically sorts its contents.
15
16
FUIIndexArray | Keeps an array synchronized to indexed data from two Firebase references.
16
17
17
-
For a more in-depth explanation of each of the above, check the usage instructions below or read the [docs](https://firebaseui.firebaseapp.com/docs/ios/index.html).
18
+
For a more in-depth explanation of each of the above, check the usage instructions below.
18
19
19
-
## FirebaseUI Database API
20
+
## API Overview
20
21
### FUITableViewDataSource
21
22
22
23
`FUITableViewDataSource` implements the `UITableViewDataSource` protocol to automatically use Firebase as a data source for your `UITableView`.
23
24
24
25
#### Swift
25
26
```swift
26
-
// YourViewController.swift
27
-
28
-
let firebaseRef = Database.database().reference()
29
-
var dataSource: FUITableViewDataSource!
30
-
31
-
self.dataSource=self.tableView.bind(to: self.firebaseRef) { tableView, indexPath, snapshot in
27
+
self.dataSource=self.tableView.bind(to: query) { tableView, indexPath, snapshot in
32
28
// Dequeue cell
33
29
let cell = tableView.dequeueReusableCell(withIdentifier: "reuseIdentifier", for: indexPath)
## Customizing your UITableView or UICollectionView
100
-
101
-
You can use `FUITableViewDataSource` or `FUICollectionViewDataSource` in several ways to create custom UITableViews or UICollectionViews. For more information on how to create custom UITableViews, check out the following tutorial on [TutsPlus](http://code.tutsplus.com/tutorials/ios-sdk-crafting-custom-uitableview-cells--mobile-15702). For more information on how to create custom UICollectionViews, particularly how to implement a UICollectionViewLayout, check out the following tutorial on Ray Wenderlich in [Objective-C](http://www.raywenderlich.com/22324/beginning-uicollectionview-in-ios-6-part-12) and [Swift](http://www.raywenderlich.com/78550/beginning-ios-collection-views-swift-part-1).
102
-
103
77
### Using the Default Table/Collection View Cell
104
78
105
-
You can use the default `UITableViewCell` or `UICollectionViewCell` implementations to get up and running quickly. For `UITableViewCell`s, this allows for the `cell.textLabel` and the `cell.detailTextLabel` to be used directly out of the box. For `UICollectionViewCell`s, you will have to add subviews to the contentView in order for it to be useful.
79
+
You can use the default `UITableViewCell` or `UICollectionViewCell` implementations to get up and running quickly. For `UITableViewCell`s, this allows for the `cell.textLabel` and the `cell.detailTextLabel` to be used directly out of the box. For `UICollectionViewCell`s, you will have to add subviews to the contentView in order for them to be useful.
// Populate cell as you see fit by adding subviews as appropriate
148
-
[cell.contentView addSubview:customView];
121
+
// Populate cell as you see fit
122
+
cell.contentView.accessibilityLabel = @"A cell";
149
123
return cell;
150
124
}];
151
125
```
@@ -156,7 +130,7 @@ FirebaseUI has several building blocks that developers should understand before
156
130
157
131
### FUIArray and the FUICollectionDelegate Protocol
158
132
159
-
`FUIArray` is synchronized array connecting a Firebase `FIRDatabaseReference` with an array. It surfaces Firebase events through the `FUICollectionDelegate` Protocol. It is generally recommended that developers not directly access `FUIArray` without routing it through a custom data source, though if this is desired, check out `FUIDataSource` below. See the header files for more in-depth documentation.
133
+
`FUIArray` is synchronized array connecting a Firebase `FIRDatabaseReference` with an array. It surfaces Firebase events through the `FUICollectionDelegate` Protocol. If you're building a multiple-section UI, you'll have to use this class directly instead of using one of the provided data sources.
0 commit comments