I have a project with two view controllers inside a navigation controller
VC1 has a scrollview
UIScrollView has 1 subview
UIView has a UITapGestureRecognizer (GR1)
VC1's view also has a UITapGestureRecognizer attached to it (GR2)
VC2's view is blank other than a back button hooked up to the unwind segue.
When VC1 is first shown, GR1 and GR2 work great.
If I perform a custom segue to VC2 and then use the UINavigationControllers interactive swipe pop gesture: everything stills works. GR1 and GR2 continue to work great.
HOWEVER if I perform a custom unwind segue from VC2 back to VC1 (triggered by the button) then GR1 continues to work but GR2 stops working.
I have no idea what is going on. I've tried cancelsTouchesInView=false and I've made sure my unwind segue looks all legit. I can see no reason why one gesture recognizer would keep working and the other stop working.
I have managed to fix it in a way I don't think anyone will believe.
I subclassed UIWindow to see where my touch events were going by overriding sendEvent. Interestingly sendEvent isn't even called when I tap on VC1 (after the unwind segue). It works fine before. This was odd to me because my understadning is that sendEvent should capture every touch event. So I knew something funky was going on.
I commented out sections of code in my custom unwind segue, until I discovered the offending line which was breaking my gesture recognizer. The line was:
destVC.view.backgroundColor = UIColor(white: 0, alpha: 1)
Everything works without this line of code (other than the background colour being different to what I want) but if I leave it in the gesture recognizer stops working + even window events aren't being captured.
Seems to be a bug.
Managed to workaround the issue by setting backgroundcolor to anything other than 100% clear in my completion block for the custom segue.