Originally created by @ThibaultVlacich on GitHub (Oct 25, 2016).
Hello,
When doing a CoreStore.fetchAll request, I haven't found a way to put a limit to number of entries to fetch. Is there a way to do that ? Something like :
Originally created by @ThibaultVlacich on GitHub (Oct 25, 2016).
Hello,
When doing a `CoreStore.fetchAll` request, I haven't found a way to put a limit to number of entries to fetch. Is there a way to do that ? Something like :
``` swift
CoreStore.fetchAll(
From(Article.self),
Where("featured = 1"),
OrderBy(.descending("date")),
Limit(10)
)
```
With CoreData alone I was doing (Swift 2) :
``` swift
let request = NSFetchRequest(entityName: "Articles")
request.fetchLimit = 10
```
@JoeMatt commented on GitHub (Oct 25, 2016):
You would use Tweak parameter to modify the NSFetchRequest directly.
``` swift
CoreStore.fetchAll(
From(Article.self),
Where("featured = 1"),
OrderBy(.descending("date")),
Tweak { (fetchRequest) -> Void in
fetchRequest.fetchLimit = 10
}
)
```
@ThibaultVlacich commented on GitHub (Oct 25, 2016):
Thanks @JoeMatt! I'm gonna take a look if maybe I can make a PR to add a convenient Limit fetch clause.
@ThibaultVlacich commented on GitHub (Oct 25, 2016):
Thanks @JoeMatt! I'm gonna take a look if maybe I can make a PR to add a convenient `Limit` fetch clause.
Semi-resurrecting this, any chance it can be put into the readme? Having to search through closed issues to find out how to limit seems crazy!
@JakeSteam commented on GitHub (Nov 4, 2017):
Semi-resurrecting this, any chance it can be put into the readme? Having to search through closed issues to find out how to limit seems crazy!
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @ThibaultVlacich on GitHub (Oct 25, 2016).
Hello,
When doing a
CoreStore.fetchAllrequest, I haven't found a way to put a limit to number of entries to fetch. Is there a way to do that ? Something like :With CoreData alone I was doing (Swift 2) :
@JoeMatt commented on GitHub (Oct 25, 2016):
You would use Tweak parameter to modify the NSFetchRequest directly.
@ThibaultVlacich commented on GitHub (Oct 25, 2016):
Thanks @JoeMatt! I'm gonna take a look if maybe I can make a PR to add a convenient
Limitfetch clause.@JakeSteam commented on GitHub (Nov 4, 2017):
Semi-resurrecting this, any chance it can be put into the readme? Having to search through closed issues to find out how to limit seems crazy!