Githawk: 3D touch issues

Created on 23 Sep 2017  路  5Comments  路  Source: GitHawkApp/GitHawk

Should be really easy

馃啎 feature request low priority

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?

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rnystrom picture rnystrom  路  3Comments

BasThomas picture BasThomas  路  3Comments

BasThomas picture BasThomas  路  3Comments

rnystrom picture rnystrom  路  3Comments

BasThomas picture BasThomas  路  3Comments