Swift UIButton a réglé par programme la fonction ONTAP

myButton.addTarget(self, action: #selector(myButtonTapped), for: .touchUpInside)
@objc func myButtonTapped() {
    print("My button was tapped!")
}
TheKrisinator