badoo / badoo/Chatto

How best to implement Peek and Pop in ChatViewController?

Open
#337 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
4.6k
Forks
588
PR merge metrics
No merged PRs in 30d

Description

Hello! How best to implement Peek and Pop in ChatViewController, I need to do this for only one particular cell, and I did the first code sketch, but this only works for the top two cels. Tell me how this is best implemented.

```
func previewingContext(_ previewingContext: UIViewControllerPreviewing, viewControllerForLocation location: CGPoint) -> UIViewController? {
guard let indexPath = collectionView?.indexPathForItem(at: location) else { return nil }
guard let cell = collectionView?.cellForItem(at: indexPath) as? ExampleMessageCollectionViewCell else { return nil }

let detailVC = UIViewController()
detailVC.view.backgroundColor = .red
previewingContext.sourceRect = cell.frame

return detailVC
}
```

Contributor guide

Open the contributing guide

Research direction

Start in ChatViewController at previewingContext(_:viewControllerForLocation:) and inspect how collectionView resolves an index path and cell. Compare the behavior across cells, especially ExampleMessageCollectionViewCell, and determine the intended Peek and Pop scope for one cell; done means the requested cell previews and pops correctly without limiting behavior to the top two cells.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.