Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahKamara authored Mar 23, 2024
1 parent ae15d02 commit 6e99619
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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<Book> { $0.pages > 50 }
let notTooLong = #Predicate<Book> { $0.pages <= 350 }
let titleFilter = #Predicate<Book> { $0.title.contains("Swift") }

let filter = #Predicate<Book> {
(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:
Expand Down

0 comments on commit 6e99619

Please sign in to comment.