You can do this a few ways.
You can attach a gesture and if you tap on a specific part of the frame, then do one thing.
func tapMethod(gesture:UITapGestureRecognizer) {
//on label
let touch = tap.locationInView(button)
If(label.frame.contains(touch)) {
//....
}
//not on label
Else {
/....
}
}
Or you can add 2 tap gestures, one on the label and one on the button, then you can override
func hitTest(_ point: CGPoint,
with event: UIEvent?) -> UIView?
This will allow you to touch on the button’s subviews if necessary as well click on the button’s actions if necessary. Here is a good example. https://medium.com/@nguyenminhphuc/how-to-pass-ui-events-through-views-in-ios-c1be9ab1626b. It reduces the coupling of code and allows for different pieces to come together. This is the hardest route but in my opinion, has the greatest benefit of allowing easiest movement and flow of code