Compiler error: Extra argument in call #179

Closed
opened 2025-12-29 15:26:18 +01:00 by adam · 3 comments
Owner

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 }
)

screen shot 2017-10-25 at 16 01 38

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 } ) ``` ![screen shot 2017-10-25 at 16 01 38](https://user-images.githubusercontent.com/229384/32002881-cf9ef97a-b99d-11e7-8419-f3ca81b12970.png) 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
adam closed this issue 2025-12-29 15:26:18 +01:00
Author
Owner

@kevinrenskers commented on GitHub (Oct 25, 2017):

And another compiler error from the same example:

let _ = CoreStore.fetchAll(
  From<Gift>(),
  Gift.ascending { $0.points }
)

screen shot 2017-10-25 at 16 04 29

@kevinrenskers commented on GitHub (Oct 25, 2017): And another compiler error from the same example: ``` let _ = CoreStore.fetchAll( From<Gift>(), Gift.ascending { $0.points } ) ``` ![screen shot 2017-10-25 at 16 04 29](https://user-images.githubusercontent.com/229384/32003025-36294ec0-b99e-11e7-9653-38004ef8e224.png)
Author
Owner

@JohnEstropia commented on GitHub (Oct 29, 2017):

You need to use orderBy first before ascending:

Gift.orderBy(ascending: { $0.points })

You can use the simpler keypath syntax as well:

let _ = CoreStore.fetchAll(
  From<Gift>()
    .where(\.isDigitalGift == true)
    .orderBy(.ascending(\.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)) ) ```
Author
Owner

@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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/CoreStore#179