RxSwiftCommunity / RxFirebase

RxSwift extensions for Firebase
MIT License
224 stars 66 forks source link

Initializer for conditional binding must have Optional type, not 'DocumentSnapshot' #32

Open MarsXan opened 4 years ago

MarsXan commented 4 years ago

DocumentSnapshot always has value. we can't use this for checking a value exist or not!

db.collection("cities") .document("SF") .rx .getDocument() .subscribe(onNext: { document in if let document = document { print("Document data: \(document.data())") } else { print("Document does not exist") } }, onError: { error in print("Error fetching snapshots: \(error)") }).disposed(by: DisposeBag())