Skip to content

Add support for Foundation.SortDescriptor - #33

Merged
colemancda merged 6 commits into
masterfrom
feature/predicate
Aug 16, 2026
Merged

Add support for Foundation.SortDescriptor#33
colemancda merged 6 commits into
masterfrom
feature/predicate

Conversation

@colemancda

@colemancda colemancda commented Aug 16, 2026

Copy link
Copy Markdown
Member

Resolves #14

Rounds out Foundation.SortDescriptor support with full bidirectional conversions, plus cross-platform SortComparator/SortOrder support via swift-foundation's FoundationEssentials:

  • FetchRequest.SortDescriptor conforms to SortComparator (comparing ModelData), with an order: SortOrder property and order-based initializers — available on all platforms with Foundation, not just Darwin.
  • FetchRequest.SortDescriptor.toFoundation(comparing:) converts back to Foundation.SortDescriptor, returning nil for function-based sort terms, which have no Foundation equivalent.
  • NSSortDescriptor round-trip: init?(_:) (nil when the sort descriptor has no key path) and toFoundation().
  • New FetchRequest convenience initializer accepting [Foundation.SortDescriptor<Root>].
  • CoreDataModel fetch request bridging now reuses the shared toFoundation() conversion.
  • Tests covering round-trips, sort orders, SortComparator sorting, the nil cases, and the new initializers.

@github-code-quality

github-code-quality Bot commented Aug 16, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: Swift

Swift / code-coverage/llvm-cov

The overall coverage in commit 635e2a0 in the feature/predicate branch remains at 95%, unchanged from commit 556dca9 in the master branch.

Show a code coverage summary of the most impacted files.
File master 556dca9 feature/predicate 635e2a0 +/-
Sources/CoreDat...chRequest.swift 100% 100% 0%
Sources/CoreMod...chRequest.swift 100% 100% 0%
Sources/CoreMod...escriptor.swift 100% 100% 0%
Sources/CoreModel/Locked.swift 0% 70% +70%

Updated August 16, 2026 14:06 UTC

@colemancda
colemancda merged commit fff8b7b into master Aug 16, 2026
29 of 32 checks passed
@colemancda
colemancda deleted the feature/predicate branch August 16, 2026 14:11
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.

Add support for Foundation.SortDescriptor

1 participant