The documentation for Cocoa's NSFetchRequest
fetchLimit
property says:
The fetch limit specifies the maximum number of objects that a request should return when executed.
If you set a fetch limit, the framework makes a best effort to improve efficiency, but does not guarantee it.
However, it doesn't tell you how to unlimit the maximum number of objects that a request should return if the fetch limit has already been set.
How can I return an unlimited number of matching objects after the previously limiting the number of objects with fetchLimit
on my NSFetchRequest
?
From some quick testing, the default value for fetchLimit
when an NSFetchRequest
is instantiated is 0, and setting the value to something other than 0 and then back to 0 will not limit the results returned.
So, as of Swift 4, set fetchLimit
to 0 to return unlimited results.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With