firebase / FirebaseUI-iOS

iOS UI bindings for Firebase.
Apache License 2.0
1.51k stars 475 forks source link

Add documentation how to transform firestore table datasource content before data is handed to the table #491

Open swftvsn opened 6 years ago

swftvsn commented 6 years ago

Hi!

I saw that this is supported in Realtime Database (#183) and was wondering if there is any documentation available how to use this in Firestore applications?

Any help and pointers are appreciated, thanks!

morganchen12 commented 6 years ago

This isn't currently supported in Firestore. You can get away with more via more flexible querying in Firestore, but there's definitely use cases that aren't covered there.

I'll see if I can get this into the next release. cc @samtstern

mickeyreiss-visor commented 6 years ago

Is there a workaround for reversing firestore results on the client similar to #436?

morganchen12 commented 6 years ago

You can use order(by:) on Firestore's Query type to sort the results the query returns. It's not a great workaround and sometimes means adding data for the sake of sorting.

mickeyreiss-visor commented 6 years ago

That works, but I can’t figure out how to combine order and limit to produce a reversed feed. For example, this is useful in a chat interface, where I want to render the 30 latest messages, newest on bottom.

It would be helpful if the data source had an option to reverse the data source.

samtstern commented 6 years ago

Ah ok I know what you're asking about. In Realtime Database we called this "limitToLast()" and it's definitely something we are missing in Cloud Firestore! We've discussed adding this, but you're right it's awkward right now.

On Wed, Aug 8, 2018 at 12:50 PM Mickey Reiss notifications@github.com wrote:

That works, but I can’t figure out how to combine order and limit to produce a reversed feed. For example, this is useful in a chat interface, where I want to render the 30 latest messages, newest on bottom.

It would be helpful if the data source had an option to reverse the data source.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/firebase/FirebaseUI-iOS/issues/491#issuecomment-411530327, or mute the thread https://github.com/notifications/unsubscribe-auth/AIEw6uKMQJOQ9TF-zlYcH5Svsr04cYgrks5uO0EDgaJpZM4VlZpB .

mickeyreiss commented 6 years ago

@samtstern Anything to share on plans for this feature? We are currently using a wrapper library called Pring which adds support for this.

red42 commented 6 years ago

I wrote a drop-in replacement in Swift for FUIBatchedArray and FUIFirestoreCollectionViewDataSource that supports filtering if anybody needs that functionality right now. I want to implement map as well, but I'm not quite sure how to or if I should modify a DocumentSnapshot.