Esqarrouth/EZSwiftExtensions

hideKeyboardWhenTappedAround blocks didSelectRowAtIndexPath

lfarah opened this issue · 8 comments

when I activate the self hiding, I cannot use didSelectRowAtIndexPath

UPDATE: There is a way to use didSelectRowAtIndexPath with hideKeyboardWhenTappedAroundAndCancelsTouchesInView(), but it isn't swifty enough.

The best would be to implement this for better naming purposes:

func hideKeyboardWhenTappedAround(cancelTouches: Bool)

"This is one of the most helpful extensions I have ever come across! Thank you! The only caution I would extend is that this can interfere with didSelectRowAtIndexPath. – Clifton Labrum Apr 5 '16 at 6:46" - from StackOverflow

Just discovered this question and implemented that method. That thing with "didSelectRow" of tableView/UICollectionView not calling literally drove me crazy. The solution is: Simply add this to your extension: tap.cancelsTouchesInView = false. That solved it for me at least. Hope this helps somebody – Quantm Jul 28 '16 at 10:27"

//Uncomment the line below if you want the tap not not interfere and cancel other interactions.
//tap.cancelsTouchesInView = false 

You've read this comment right?

@goktugyil yes. The thing is that we must provide a solution on EZSwiftExtensions.
Maybe something like
hideKeyboardWhenTappedAround(cancelTouches: Bool)

What do you think?

@lfarah
The solution is already exists. hideKeyboardWhenTappedAroundAndCancelsTouchesInView()
If you implement above method, would you remove this method?

Hmmmm yes! But do you agree that is not Swifty?

Yes! I agree that is not Swifty.

Its time to get Schwifty