Comments (10)
This won't be possible right now because Realm doesn't make available limiting through their query API (I believe the TightDB core offers this though they just haven't added it to the wrapper). So the only way would be to loop through the RLMResults and copy the first X into a NSArray for example. You can do this manually since it wouldn't make sense to setup RBQFetchrequest to work this way, because if you don't need a limit this isn't very performant. Makes sense?
from rbqfetchedresultscontroller.
FYI: here's relevant Realm issue regarding adding a limit to RLMResults (which RBQFetchRequest uses) realm/realm-swift#1448
from rbqfetchedresultscontroller.
Thanks for your reply.I'll try other way to solve my problem, wish realm can update soon.
from rbqfetchedresultscontroller.
No problem, sorry couldn't be of more help. The one thing I should note is that at least in terms of memory management it isn't necessary to limit the results since RLMResults lazy loads the objects. So if you simply used the RLMResults directly as a UITableView datasource (instead of the FRC since internally it has its own cache complicating my point), then when the user scrolls and a cell is created, only then is the data accessed from the object at that specific index in the RLMResults. This prevents the need to limit the results or do any paging.
from rbqfetchedresultscontroller.
Yeah, I limit the count just for paging logic.
from rbqfetchedresultscontroller.
Ah, well in that case if you are simply trying to achieve a UI effect, you don't need to actually page the RLMResults to improve performance. Just limit the rows on the UITableview manually (i.e. don't match the rows in UITableview datasource to the RLMResults count), and then increase this by X until you reach the results count in response to the user requesting to see more.
from rbqfetchedresultscontroller.
The only tricky thing with this would be if you plan to use RBQFetchedResultsController to manage changes to the UITableView, you would have to catch any delegate calls that reference a index path that is not currently visible and not pass that change to the UITableView or you will get an assertion failure.
from rbqfetchedresultscontroller.
That's the problem so I tried other way: every model I have a flag and I reset all model's flag to false after refresh then set the new fetched model's flag to true then addOrUpdate.Througn this way i can limit the count.
from rbqfetchedresultscontroller.
Ah that makes sense, glad you figured out a fix for the time being.
from rbqfetchedresultscontroller.
Great thanks! I noticed this post is a bit old, are there any updates?
from rbqfetchedresultscontroller.
Related Issues (20)
- Support transient properties for sectionNameKeyPath HOT 4
- Don't release delegate HOT 5
- Crash on `performFetch` - Index is out of bounds
- Ability to turn off excessive logging for debug builds HOT 3
- When init with a empty realm, the `notificationCollection`'s `notificationBlock` might never got call
- Dead lock when FRC -updateFetchRequest in main thread and -calculateChangesWithAddedSafeObjects in background within same time;
- RBQFetchedRequest support for Properties to Group By
- Swift3 no notification passed to the delegate HOT 1
- RealmSwift 2.1.1 HOT 1
- Reintroduce Git Submodules for RBQSafeRealmObject and RealmUtilities HOT 1
- Crash when deleting sectioned objects.
- Constant crash. HOT 1
- Delegate never released HOT 7
- Update Realm dependency to 2.2
- Sorting with localizedCaseInsensitiveCompare
- SectionNameKeyPath cannot be transient? HOT 1
- Can't support Realm 3.0.0? HOT 6
- can not support Realm (3.7.4)
- Not working with swift 4
- Could you make unregisterChangeNotifications public
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rbqfetchedresultscontroller.