Skip to content
This repository has been archived by the owner on Feb 8, 2022. It is now read-only.

Commit

Permalink
Merge pull request #60 from bronenos/dev-stan-sections-descending-sor…
Browse files Browse the repository at this point in the history
…ting

Support for descending sort when use grouping
  • Loading branch information
isaacroldan committed Jan 8, 2016
2 parents 01dbe74 + c4859e9 commit 02d57fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Source/RealmResultsCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,9 @@ class RealmResultsCache<T: Object> {
Sort the sections using the Given KeyPath
*/
private func sortSections() {
sections.sortInPlace { $0.keyPath.localizedCaseInsensitiveCompare($1.keyPath) == NSComparisonResult.OrderedAscending }
guard let sortd = request.sortDescriptors.first else { return }
let comparator: NSComparisonResult = sortd.ascending ? .OrderedAscending : .OrderedDescending
sections.sortInPlace { $0.keyPath.localizedCaseInsensitiveCompare($1.keyPath) == comparator }
}

/**
Expand Down

0 comments on commit 02d57fe

Please sign in to comment.