Skip to content

Commit

Permalink
Merge pull request #1 from roanutil/rename-package-and-raise-minimum-…
Browse files Browse the repository at this point in the history
…swift-version

Rename package and raise minimum swift version
  • Loading branch information
roanutil authored Dec 31, 2022
2 parents 0d3c0f9 + 6490fbb commit e227d37
Show file tree
Hide file tree
Showing 34 changed files with 175 additions and 312 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ jobs:
strategy:
matrix:
include:
- os: macos-11
xcode: '12.4' # swift 5.3
- os: macos-11
xcode: '12.5.1' # swift 5.4
- os: macos-12
xcode: '13.2.1' # swift 5.5
- os: macos-12
Expand All @@ -37,7 +33,7 @@ jobs:
- name: Run Tests
run: swift test --enable-code-coverage --parallel
- name: Swift Coverage Report
run: xcrun llvm-cov export -format="lcov" .build/debug/SwiftFilterPackageTests.xctest/Contents/MacOS/SwiftFilterPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage_report.lcov
run: xcrun llvm-cov export -format="lcov" .build/debug/swift-filterPackageTests.xctest/Contents/MacOS/swift-filterPackageTests -instr-profile .build/debug/codecov/default.profdata > coverage_report.lcov
- uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true # optional (default = false)
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
--redundanttype explicit
--swiftversion 5.5
--maxwidth 120
--header "{file}\nSwiftFilter\n\n\nMIT License\n\nCopyright © {year} Andrew Roan"
--header "{file}\nFilter\n\n\nMIT License\n\nCopyright © {year} Andrew Roan"
--allman false
35 changes: 17 additions & 18 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
// swift-tools-version:5.5

import PackageDescription

let package = Package(
name: "SwiftFilter",
name: "swift-filter",
products: [
.library(
name: "SwiftFilter",
targets: ["SwiftFilter"]
name: "Filter",
targets: ["Filter"]
),
.library(
name: "SwiftFilterNSPredicate",
targets: ["SwiftFilterNSPredicate"]
name: "FilterNSPredicate",
targets: ["FilterNSPredicate"]
),
.library(
name: "SwiftFilterClosure",
targets: ["SwiftFilterClosure"]
name: "FilterClosure",
targets: ["FilterClosure"]
),
],
dependencies: [],
targets: [
.target(
name: "SwiftFilter",
name: "Filter",
dependencies: []
),
.testTarget(
name: "SwiftFilterClosureTests",
dependencies: ["SwiftFilterClosure"]
name: "FilterClosureTests",
dependencies: ["FilterClosure"]
),
.testTarget(
name: "SwiftFilterNSPredicateTests",
dependencies: ["SwiftFilterNSPredicate"]
name: "FilterNSPredicateTests",
dependencies: ["FilterNSPredicate"]
),
.target(
name: "SwiftFilterNSPredicate",
name: "FilterNSPredicate",
dependencies: [
"SwiftFilter",
"Filter",
]
),
.target(
name: "SwiftFilterClosure",
name: "FilterClosure",
dependencies: [
"SwiftFilter",
"Filter",
]
),
]
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# SwiftFilter
# Filter

[![CI](https://github.com/roanutil/SwiftFilter/actions/workflows/ci.yml/badge.svg)](https://github.com/roanutil/SwiftFilter/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/roanutil/SwiftFilter/branch/main/graph/badge.svg?token=86G7F92SM2)](https://codecov.io/gh/roanutil/SwiftFilter)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Froanutil%2FSwiftFilter%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/roanutil/SwiftFilter)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Froanutil%2FSwiftFilter%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/roanutil/SwiftFilter)
[![CI](https://github.com/roanutil/swift-filter/actions/workflows/ci.yml/badge.svg)](https://github.com/roanutil/swift-filter/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/roanutil/swift-filter/branch/main/graph/badge.svg?token=86G7F92SM2)](https://codecov.io/gh/roanutil/swift-filter)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Froanutil%2FFilter%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/roanutil/swift-filter)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Froanutil%2FFilter%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/roanutil/swift-filter)

SwiftFilter is a library that makes it easy to model filters in state and then create predicates from that state.
Filter is a library that makes it easy to model filters in state and then create predicates from that state.

## Included Products
- SwiftFilter
- SwiftFilterClosure
- SwiftFilterNSPredicate
- Filter
- FilterClosure
- FilterNSPredicate

## SwiftFilter
## Filter
Core library that supports filter modeling and protocols for predicates.

SwiftFilterClosure and SwiftFilterNSPredicate provide good examples of implementing the predicate protocols.
FilterClosure and FilterNSPredicate provide good examples of implementing the predicate protocols.

### Example
```swift
Expand All @@ -31,13 +31,13 @@ let filteredByClosure = dates.filter(closure)
let filteredByNSPredicate = dates.filter { nsPredicate.evaluate(with: $0) }
```

## SwiftFilterClosure
## FilterClosure
Implementations of strongly typed predicate protocols that produce closures for filtering

## SwiftFilterNSPredicate
## FilterNSPredicate
Implementation of type erased predicate protocols that produce `NSPredicate`s.

## Installation
Add SwiftFilter to your Xcode project with Swift Package Manager.
Add Filter to your Xcode project with Swift Package Manager.

Use the https URL from this repository in the Xcode Swift Packages dialogue or package manifest.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// AnyComparablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ComparableFilter.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down Expand Up @@ -51,3 +51,7 @@ public enum ComparableFilter<T: Comparable>: Equatable {
extension ComparableFilter: Hashable where T: Hashable {}

extension ComparableFilter.Optional: Hashable where T: Hashable {}

extension ComparableFilter: Sendable where T: Sendable {}

extension ComparableFilter.Optional: Sendable where T: Sendable {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ComparablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// OptionalAnyComparablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// OptionalComparablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// AnyEquatablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// EquatableFilter.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down Expand Up @@ -47,3 +47,7 @@ public enum EquatableFilter<T: Equatable>: Equatable {
extension EquatableFilter: Hashable where T: Hashable {}

extension EquatableFilter.Optional: Hashable where T: Hashable {}

extension EquatableFilter: Sendable where T: Sendable {}

extension EquatableFilter.Optional: Sendable where T: Sendable {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// EquatablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// OptionalAnyEquatablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// OptionalEquatablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Closure+ComparablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
//
// Copyright © 2022 Andrew Roan

import Filter
import Foundation
import SwiftFilter

// swiftlint:disable cyclomatic_complexity

extension Closure: ComparablePredicate where Value: Comparable {
/// Creates a closure `(Self) -> Bool` from a ComparableFilter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Closure+EquatablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
//
// Copyright © 2022 Andrew Roan

import Filter
import Foundation
import SwiftFilter

extension Closure: EquatablePredicate where Value: Equatable {
/// Creates a closure `(Self) -> Bool` from a EquatableFilter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Closure+OptionalComparablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
//
// Copyright © 2022 Andrew Roan

import Filter
import Foundation
import SwiftFilter

extension Closure: OptionalComparablePredicate where Value: Comparable {
/// Creates a closure `(Self) -> Bool` from a ComparableFilter.Optional
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Closure+OptionalEquatablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
//
// Copyright © 2022 Andrew Roan

import Filter
import Foundation
import SwiftFilter

extension Closure: OptionalEquatablePredicate where Value: Equatable {
/// Creates a closure `(Self) -> Bool` from a EquatableFilter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Closure.swift
// SwiftFilter
// Filter
//
//
// MIT License
//
// Copyright © 2022 Andrew Roan

import Filter
import Foundation
import SwiftFilter

public enum Closure<Root, Value> {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// NSExpression+ComparableOperators.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// NSExpression+EquatableOperators.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// NSPredicate+AnyComparablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
//
// Copyright © 2022 Andrew Roan

import Filter
import Foundation
import SwiftFilter

// swiftlint:disable cyclomatic_complexity

extension NSPredicate: AnyComparablePredicate {
/// Creates a NSPredicate from a ComparableFilter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// NSPredicate+AnyEquatablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
//
// Copyright © 2022 Andrew Roan

import Filter
import Foundation
import SwiftFilter

extension NSPredicate: AnyEquatablePredicate {
/// Creates a NSPredicate from a EquatableFilter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// NSPredicate+CompoundOperators.swift
// SwiftFilter
// Filter
//
//
// MIT License
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// NSPredicate+OptionalAnyComparablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
//
// Copyright © 2022 Andrew Roan

import Filter
import Foundation
import SwiftFilter

extension NSPredicate: OptionalAnyComparablePredicate {
/// Creates a NSPredicate from a ComparableFilter.Optional
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// NSPredicate+OptionalAnyEquatablePredicate.swift
// SwiftFilter
// Filter
//
//
// MIT License
//
// Copyright © 2022 Andrew Roan

import Filter
import Foundation
import SwiftFilter

extension NSPredicate: OptionalAnyEquatablePredicate {
/// Creates a NSPredicate from a EquatableFilter.Optional
Expand Down
Loading

0 comments on commit e227d37

Please sign in to comment.