I have the following setup :

[![enter image description here](https://i.stack.imgur.com/HGsFH.png)](https://i.stack.imgur.com/HGsFH.png)

1. Blue background at zPosition = 0
2. Yellow button at zPosition = 0 with an action to print "Button tapped"
3. UIView with grey background and 0.8 alpha at zPosition = 1 with a UITapGestureRecognizer with an action to print "Grey view tapped"

When I tapped at the grey area, "Grey view tapped" is printed.
But if I tapped at the location of the yellow button, "Button tapped" is printed.
I expected to always have printed "Grey view tapped" because that view is in front of the button.
How can I prevent the button that is behind a view to be triggered ?

I know that I can set the button to .isEnabled = false but that is not a suitable solution since the grey background is created in a parent view controller from witch all my views are inheriting.

I set the grey view to `.isUserInteractionEnabled = true` (even if it's the default value) as stated here : [In Stackoverflow](https://stackoverflow.com/questions/41177935/preventing-touches-from-happening-behind-a-view%20but%20the%20button%20is%20still%20being%20triggered.)

I thought using [Apple Documentation](https://developer.apple.com/documentation/uikit/touches_presses_and_gestures/coordinating_multiple_gesture_recognizers/preferring_one_gesture_over_another) but the problem is that there are a button and a gesture recognizer instead of multiple gesture recognizers.

Any idea on how to do this properly?