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

Added ability to change a sort descriptor of an already existing data… #119

Merged
merged 1 commit into from
Oct 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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