diff --git a/README.md b/README.md index 590131b..4cf680a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,21 @@ [![Build & Test](https://github.com/NoahKamara/CompoundPredicate/actions/workflows/build-and-test.yml/badge.svg)](https://github.com/NoahKamara/CompoundPredicate/actions/workflows/build-and-test.yml) +## For Developers targeting macOS 14.4 / iOS 17.4 or later: + +This [PR](https://github.com/apple/swift-foundation/pull/343) For Swift Foundation adds compound functionality to Predicates like so: +If you are targeting only those versions and above you should use this instead: + +```swift +let notTooShort = #Predicate { $0.pages > 50 } +let notTooLong = #Predicate { $0.pages <= 350 } +let titleFilter = #Predicate { $0.title.contains("Swift") } + +let filter = #Predicate { + (notTooShort.evaluate($0) && notTooLong.evaluate($0)) || titleFilter.evaluate($0) +} +``` + + # CompoundPredicate CompoundPredicate aims to improve the Predicate system to enable combining multiple predicates after constructing them: