 extension SearchViewController: UIViewControllerPreviewingDelegate {
 
     func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
-        guard let indexPath = tableView?.indexPathForRow(at: location),
-            let cell = tableView?.cellForRow(at: indexPath),
+        guard let tableView = previewingContext.sourceView as? UITableView,
+            let indexPath = tableView.indexPathForRow(at: location),
+            let cell = tableView.cellForRow(at: indexPath),
             let model = models?[indexPath.row],
             let controller: PostPreviewViewController = UIStoryboard(for: .PostPreview, with: AppConstants.bundle).instantiateViewController()
                 else { return nil }

        }
        
        if traitCollection.forceTouchCapability == .available {
            registerForPreviewing(with: self, sourceView: tableView)
        }
    }
    

    var models: Results<Post>?
    let service = PostService()
    let cellNibName: String? = nil
    var previewingContext: UIViewControllerPreviewing?
    
    var dataView: DataViewable {
        return tableView
