How can I set a Button for longPress code?

Hi, I am a iOS developer beginner, I have question:
How can I set a Button for longPress code?

Do the Foundations course. After you have done so, do the Sound Recorder App One-Day Build as it will equip you with the skills to build what you want.

You have to add a Long Press Gesture Recognizer to the button. You need to connect your button to the View Controller as an IBOutlet property. You need to create a long press gesture recognizer object with the target and the selector initializer. add the long press gesture recognizer to your button using the addGestureRecognizer method. Hope this helps.