RxSwiftCommunity / RxFirebase

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

getDocuments with source #19

Closed mobiletoly closed 5 years ago

mobiletoly commented 5 years ago

Similar to this: https://github.com/RxSwiftCommunity/RxFirebase/issues/16

we also need to add a function supporting source to query documents (instead of a single document). The one in

extension Reactive where Base: Query {
 ...
 // e.g.
public func getDocuments(source: FirestoreSource) -> Observable<QuerySnapshot> {
        return Observable<QuerySnapshot>.create { observer in
            self.base.getDocuments(source: source) { snapshot, error in
                if let error = error {
                    observer.onError(error)
                } else if let snapshot = snapshot {
                    observer.onNext(snapshot)
                }
                observer.onCompleted()
            }
            return Disposables.create()
        }
    }
}

I have a valid use case for that.

arnauddorgans commented 5 years ago

Thanks for your feeback, do you need anything else ? :)

mobiletoly commented 5 years ago

Alright, alright, I didn't mean to sound so demanding :) Thank you for your hard work!

arnauddorgans commented 5 years ago

Ahah sorry it was not mean, it was a real question 😂

arnauddorgans commented 5 years ago

If you need anything else i’ll add it to the next version :)

mobiletoly commented 5 years ago

thanks, I really appreciate it. I'm writing my first firebase-based project in iOS (used Firebase with Android before), and so far really enjoying RxFirebase.

arnauddorgans commented 5 years ago

Available in 0.3.7