     fileprivate let reuseIdentifier = "SavedArticleCollectionViewCell"
     
     override func setupFetchedResultsController(with dataStore: MWKDataStore) {
-        setupFetchedResultsController(with: dataStore, sortBy: "savedDate", ascending: false)
-    }
-    
-    fileprivate func sort(by key: String, ascending: Bool) {
-        setupFetchedResultsController(with: dataStore, sortBy: key, ascending: ascending)
-        do {
-            try fetchedResultsController.performFetch()
-        } catch let err {
-            assertionFailure("Couldn't sort by \(key): \(err)")
-        }
-        collectionView?.reloadData()
-    }
-    
-    fileprivate func setupFetchedResultsController(with dataStore: MWKDataStore, sortBy key: String, ascending: Bool) {
         let articleRequest = WMFArticle.fetchRequest()
         articleRequest.predicate = NSPredicate(format: "savedDate != NULL")
-        articleRequest.sortDescriptors = [NSSortDescriptor(key: key, ascending: ascending)]
+        articleRequest.sortDescriptors = [sortDescriptor]
         fetchedResultsController = NSFetchedResultsController(fetchRequest: articleRequest, managedObjectContext: dataStore.viewContext, sectionNameKeyPath: nil, cacheName: nil)
     }
+    
+    // MARK: - Sorting
+    
+    fileprivate var sortDescriptor: NSSortDescriptor = NSSortDescriptor(key: "savedDate", ascending: false) {
+        didSet {
+            guard sortDescriptor != oldValue else {
+                return
+            }
+            setupFetchedResultsController(with: dataStore)
+            collectionViewUpdater = CollectionViewUpdater(fetchedResultsController: fetchedResultsController, collectionView: collectionView!)
+            do {
+                try fetchedResultsController.performFetch()
+            } catch let err {
+                assertionFailure("Couldn't sort by \(sortDescriptor.key ?? "unknown key"): \(err)")
+            }
+            collectionView?.reloadData()
+        }
+    }
+    
+    fileprivate func sort(by key: String, ascending: Bool) {
+        sortDescriptor = NSSortDescriptor(key: key, ascending: ascending)
+    }
+    
+    // MARK: - Swipe actions
     
     override func canSave(at indexPath: IndexPath) -> Bool {
         return false

extension SavedArticlesCollectionViewController: SavedViewControllerDelegate {
    
    @objc func didPressSortButton() {
        let alert = UIAlertController(title: "Sort saved articles", message: nil, preferredStyle: .actionSheet)
        let titleAction = UIAlertAction(title: "Title", style: .default) { (actions) in
            self.sort(by: "displayTitle", ascending: true)
        }
        let recentlyAddedAction = UIAlertAction(title: "Recently added", style: .default) { (actions) in
            print("Recently added")
        }
        let recentlyUpdatedAction = UIAlertAction(title: "Recently updated", style: .default) { (actions) in
            print("Recently updated")
        }
        let cancelAction = UIAlertAction(title: "Cancel", style: .cancel) { (actions) in
            self.dismiss(animated: true, completion: nil)
        }
        alert.addAction(titleAction)
        alert.addAction(recentlyAddedAction)
        alert.addAction(recentlyUpdatedAction)
        alert.addAction(cancelAction)
        // add sourceView for iPad
        present(alert, animated: true, completion: nil)
    }
}

        NSUserActivity.wmf_makeActive(NSUserActivity.wmf_savedPagesView())
    }
    
    // MARK: - Analytics
    
    override var analyticsName: String {
        return "Saved Articles"
    }
