It's weird because I see there are 2 versions of fetchAll, one that accept an array and one that accepts a series of fetch clauses. It seems it's picking the array one for some reason?
Originally created by @kevinrenskers on GitHub (Oct 25, 2017).
This example comes pretty much straight from https://github.com/JohnEstropia/CoreStore#type-safe-corestoreobjects but it's not compiling for me.
```
let _ = CoreStore.fetchAll(
From<Gift>(),
Gift.where { $0.isDigitalGift == true },
Gift.ascending { $0.points }
)
```

It's weird because I see there are 2 versions of `fetchAll`, one that accept an array and one that accepts a series of fetch clauses. It seems it's picking the array one for some reason?
adam
added the question label 2025-12-29 15:26:18 +01:00
@kevinrenskers commented on GitHub (Oct 25, 2017):
And another compiler error from the same example:
let _ = CoreStore.fetchAll(
From<Gift>(),
Gift.ascending { $0.points }
)
@kevinrenskers commented on GitHub (Oct 25, 2017):
And another compiler error from the same example:
```
let _ = CoreStore.fetchAll(
From<Gift>(),
Gift.ascending { $0.points }
)
```

@JohnEstropia commented on GitHub (Oct 29, 2017):
You need to use `orderBy` first before `ascending`:
```swift
Gift.orderBy(ascending: { $0.points })
```
You can use the simpler keypath syntax as well:
```swift
let _ = CoreStore.fetchAll(
From<Gift>()
.where(\.isDigitalGift == true)
.orderBy(.ascending(\.points))
)
```
@kevinrenskers commented on GitHub (Oct 29, 2017):
Yea I’m indeed using Gift.orderBy(ascending: { $0.points }) but it needs to be fixed in your readme :)
That other syntax looks nice, I don’t think it’s in the readme either? Other things related to CoreStoreObject are missing from the readme too, like the delete rules on relationships, adding an index to a property, etc.
I can send a PR your way fixes some changes.
@kevinrenskers commented on GitHub (Oct 29, 2017):
Yea I’m indeed using `Gift.orderBy(ascending: { $0.points })` but it needs to be fixed in your readme :)
That other syntax looks nice, I don’t think it’s in the readme either? Other things related to CoreStoreObject are missing from the readme too, like the delete rules on relationships, adding an index to a property, etc.
I can send a PR your way fixes some changes.
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 @kevinrenskers on GitHub (Oct 25, 2017).
This example comes pretty much straight from https://github.com/JohnEstropia/CoreStore#type-safe-corestoreobjects but it's not compiling for me.
It's weird because I see there are 2 versions of
fetchAll, one that accept an array and one that accepts a series of fetch clauses. It seems it's picking the array one for some reason?@kevinrenskers commented on GitHub (Oct 25, 2017):
And another compiler error from the same example:
@JohnEstropia commented on GitHub (Oct 29, 2017):
You need to use
orderByfirst beforeascending:You can use the simpler keypath syntax as well:
@kevinrenskers commented on GitHub (Oct 29, 2017):
Yea I’m indeed using
Gift.orderBy(ascending: { $0.points })but it needs to be fixed in your readme :)That other syntax looks nice, I don’t think it’s in the readme either? Other things related to CoreStoreObject are missing from the readme too, like the delete rules on relationships, adding an index to a property, etc.
I can send a PR your way fixes some changes.