@Versus answer works, but has a few peculiar behaviors. It causes CustomView to intercept taps outside its frame, and it prevents buttons in the cover view (view5) from working. This version of hitTest fixes those cases:
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
if view1.point(inside: self.convert(point, to: view1), with: event) {
// inside view1
return view1
} else if self.point(inside: point, with: event) {
// inside CustomView (but outside view1)
return super.hitTest(point, with: event) // superview's tapped view
} else {
// outside CustomView
return nil
}
}