Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to compare an object that is not a primitive #19

Closed
crewmate-app opened this issue Apr 4, 2023 · 2 comments
Closed

Not able to compare an object that is not a primitive #19

crewmate-app opened this issue Apr 4, 2023 · 2 comments
Assignees

Comments

@crewmate-app
Copy link

I'm getting this warning:

Operator function '==' requires that 'User' conform to 'Primitive'

When trying to compare an object within a predicate

Example:
var predicate = (\CustomItemEntry.owner) == user

where owner/user are NSManagedObjects

@ftchirou ftchirou self-assigned this Apr 18, 2023
@ftchirou
Copy link
Owner

Yes, for the moment you can only compare primitives. In your case, see if you can just compare a property that holds a unique value; perhaps an id: \CustomItemEntry.owner.id == user.id. I'll investigate whether it's worth adding an overload of == for Identifiables for cases like this.

@ftchirou
Copy link
Owner

Fixed in the latest release. You will now be able to compare objects that conform to Identifiable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant