Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using ReSwift with a NSFetchResultsController? #445

Open
mycroftcanner opened this issue Aug 7, 2020 · 2 comments
Open

Using ReSwift with a NSFetchResultsController? #445

mycroftcanner opened this issue Aug 7, 2020 · 2 comments

Comments

@mycroftcanner
Copy link

How would you model state in a table view driven by an NSFetchResultsController?

I can let the NSFetchResultsControllerDelegateupdate the table view by inserting, updating, moving and deleting view and when the delegate methodcontrollerDidChangeContent(_:)is called, update the state using the fetch results controller's propertyfetchedObjects`.

@dani-mp
Copy link
Contributor

dani-mp commented Aug 7, 2020

That seems like a sensible approach. What does NSFetchResultsController give you on top of ReSwift so you need to use it, though? They kind of serve a similar purpose.

@mycroftcanner
Copy link
Author

mycroftcanner commented Aug 7, 2020

One of the biggest advantages is that a FRC can monitor storage changes for you and notify your provided delegate of said changes. Whether the data set has an entry added, removed or updated.

If I use the FRC fetchedObjects and convert my entities to structs I will lose the benefits of faults (large objects can be represented by a fault instead, until they really are needed.) unless I just map fetchedObjects to their objectIDs and only keep the objectIDs in the state and create a state for a cell lazily when it is needed (when faulting).

My entities are updating continually in the background

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants