Should be really easy
You mean 3d touch a cell to get a preview of the issue / PR comments? Would be cool to have some quick actions there too: open/close, mark as read, open in Safari maybe?
@BasThomas yes to all of it!
Was just thinking of this again was gonna raise issue but looks like it already exists!
My thought was an action being to bookmark as well, would be pretty neat to bookmark an item in my inbox without having to open it!
I tried this but I think I need an IGListKit crash course :(
In the NotificationsViewController's viewDidLoad():
if traitCollection.forceTouchCapability == .available {
registerForPreviewing(with: self, sourceView: view)
}
Then conform to UIViewControllerPreviewingDelegate:
// MARK: UIViewControllerPreviewingDelegate
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = feed.adapter.collectionView?.indexPathForItem(at: location), let cell = feed.adapter.collectionView?.cellForItem(at: indexPath) else { return nil }
// now what? `feed.adapter.object` does not want an indexPath.
let viewController = // get some vc if we know the object
previewingContext.sourceRect = cell.frame
return nil
}
func previewingContext(_ previewingContext: UIViewControllerPreviewing, commit viewControllerToCommit: UIViewController) {
// present the vc
}
But I don't know how to proceed in the viewControllerForLocation function.
Side question: what's the difference between feed.adapter.collectionView (which is optional) and feed.collectionView (which is not)?
Here's the branch I was working on.
It looks like you just need to take the indexPath.section to retrieve the object from the IGListAdapter, then create an IssuesViewController.
Side question: what's the difference between feed.adapter.collectionView (which is optional) and feed.collectionView (which is not)?
They are the same thing, its just that IGListAdapter holds a weak ref to the collection view. Whereas Feed is strong.
Most helpful comment
You mean 3d touch a cell to get a preview of the issue / PR comments? Would be cool to have some quick actions there too: open/close, mark as read, open in Safari maybe?