Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
Added ability to change a sort descriptor of an already existing data…
Browse files Browse the repository at this point in the history
… source (#119)
  • Loading branch information
rlester authored and 3lvis committed Oct 2, 2019
1 parent 5da73eb commit 8c179d7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Source/DATASource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,23 @@ public class DATASource: NSObject {
}
}

/**
The DATASource's sort descriptors.
*/
@objc public var sortDescriptor: [NSSortDescriptor]? {
get {
return self.fetchedResultsController.fetchRequest.sortDescriptors
}

set {
self.cachedSectionNames = [String]() as [Any]
self.fetchedResultsController.fetchRequest.sortDescriptors = newValue
self.fetch()
self.tableView?.reloadData()
self.collectionView?.reloadData()
}
}

/**
The number of objects fetched by DATASource.
*/
Expand Down

0 comments on commit 8c179d7

Please sign in to comment.