Skip to content

Start implementing NSPredicate #131

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

Closed
wants to merge 2 commits into from
Closed

Conversation

5sw
Copy link

@5sw 5sw commented Dec 11, 2015

Started implementing predicates. Currently the constant and block-based predicates are done.

Since the class-cluster approach from Objective-C is not possible in Swift I replaced it with an internal protocol PredicateEvaluator. Depending on the type of predicate (that is which initializer is used) a different implementation of PredicateEvaluator is chosen. (So basically the Pimpl idiom from C++)

If you guys agree with this I will finish implementing NSPredicate and NSExpression in that style.

One thing I don't know how to solve is implementing predicateWithSubstitutionVariables. Since the return type is Self it would have to use self.dynamicType.init with a required initializer, but there is no suitable initializer. I'd appreciate any hints how to implement this without having to change the public API.

@parkera
Copy link
Contributor

parkera commented Dec 14, 2015

I accepted an earlier PR that started the Predicate implementation, so we should rebase this one on top of that if it's still adding more functionality.

predicateWithSubstitutionVariables may be impossible to implement without factory methods... I will take a closer look and see if I can figure something out too.

@5sw
Copy link
Author

5sw commented Dec 25, 2015

Closing this, adds nothing new to the other PR.

@5sw 5sw closed this Dec 25, 2015
atrick pushed a commit to atrick/swift-corelibs-foundation that referenced this pull request Jan 12, 2021
[docs] Add documentation about writing tests
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

Successfully merging this pull request may close these issues.

2 participants