ReactiveSwift extensions for Firebase.
ReactiveFirebase
adds ReactiveSwift
extensions for several Firebase components. Currently FirebaseAuth, FirebaseDatabase, and FirebaseStorage are supported.
NOTE: The CocoaPod does not currently work. Firebase distributes their SDK as a static library which makes distributing this as a CocoaPod very difficult. Your best bet for now is to drop the source files into your Xcode project manually.
You can use CocoaPods to install ReactiveFirebase
by adding it to your Podfile
:
use_frameworks!
pod 'ReactiveFirebase'
- Download and drop all the
.swift
files into your project. - There is no step two.
Here's a few simple examples.
import ReactiveFirebase
FIRDatabase.database().reference(withPath: "users")
.child(userID)
.reactive
.value
.startWithValues { user in
// do something with your user JSON
}
import ReactiveFirebase
FIRAuth.auth()
.reactive
.currentUser
.startWithValues { user in
// do something with your FIRUser
}
I would love for you to contribute to ReactiveFirebase, check the LICENSE
file for more info. I'd be happy to review any pull requests.
You can find me on Twitter @edc1591
Distributed under the MIT license. See LICENSE
for more information.