Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use optional in collectionView:shouldShowMenuForItemAtIndexPath: #310

Merged
merged 3 commits into from
May 30, 2017

Conversation

raisaanjani92
Copy link
Contributor

When I added new menu item for the collection view, I encountered problem in
open func collectionView(_ collectionView: UICollectionView, shouldShowMenuForItemAt indexPath: IndexPath)

There are cases where the indexpath is nil, thus trigger runtime error.
screen shot 2017-04-13 at 20 24 00

I tried to fix it by adding optional for indexPath: IndexPath.

@codecov-io
Copy link

codecov-io commented Apr 15, 2017

Codecov Report

Merging #310 into master will decrease coverage by 0.05%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #310      +/-   ##
==========================================
- Coverage   63.33%   63.28%   -0.06%     
==========================================
  Files          63       63              
  Lines        3516     3519       +3     
==========================================
  Hits         2227     2227              
- Misses       1289     1292       +3
Impacted Files Coverage Δ
...Controller/BaseChatViewController+Presenters.swift 44.44% <0%> (-2.23%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2b378d...dd421e7. Read the comment docs.

@AntonPalich
Copy link
Contributor

Hello @raisaanjani92. Sorry for the late response. Can I ask you to put a comment
before guard statement?

// Note: IndexPath set optional due to https://github.com/badoo/Chatto/issues/310
// Might be related: https://bugs.swift.org/browse/SR-2417

@raisaanjani92
Copy link
Contributor Author

Done, thank you!

@AntonPalich AntonPalich merged commit 0eb7ac5 into badoo:master May 30, 2017
@Hartistic
Copy link

Seems like there could be an easier way to handle this rather than changing the optionality and creating warnings. This was done back in 2017? Perhaps time to revisit this and create a better solution? How can the nil bug be reproduced? Just asking because I am not able to reproduce this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants