Custom UIView not receiving touches in iOS 17 on specific devices
I'm prototyping a solution and I need some guidance on I'm experiencing an scenario where a custom UIView subclass is not receiving touch events on certain devices running iOS 17. The view is supposed to handle tap gestures, but on an iPhone 14, it appears unresponsive, while it works perfectly on the simulator and other devices. I've set up the gesture recognizer like this: ```swift class CustomView: UIView { override init(frame: CGRect) { super.init(frame: frame) let tapGesture = UITapGestureRecognizer(target: self, action: #selector(handleTap)) self.addGestureRecognizer(tapGesture) } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } @objc func handleTap() { print("View tapped!") } } ``` I've verified that the view is indeed being added to the view hierarchy correctly and that `isUserInteractionEnabled` is set to true. However, it seems that the gesture recognizer is not being triggered. I also noticed that the view has a transparent background, which might be an scenario, so I tried setting a background color for testing: ```swift self.backgroundColor = .red ``` Still no luck. The view's frame is correct and it overlaps with other views, but I suspect that some other view might be intercepting the touches. I've tried logging the touch events in the `hitTest(_:with:)` method to see if they are even reaching my view, but it doesn't seem to be getting called: ```swift override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { print("Hit test called") return super.hitTest(point, with: event) } ``` I've also confirmed that there are no other gesture recognizers or views that might be blocking the touches. Any insights into what might be causing this scenario? This behavior is quite puzzling, especially since it works on other devices. Is there a known scenario with touch handling in iOS 17? Or is there something specific I should check for the iPhone 14? This is part of a larger REST API I'm building. Any examples would be super helpful. This is part of a larger REST API I'm building. What would be the recommended way to handle this?