There is a longTap function, so you need to call it from another similar function. How to do it?

@IBAction func longTap(sender: UILongPressGestureRecognizer) { let alert = UIAlertController(title: "Сохранение изображения", message: "Вы действительно хотите сохранить изображение?", preferredStyle: .Alert) alert.addAction(UIAlertAction(title: "Да", style: .Default, handler: { (alertAction) -> Void in UIImageWriteToSavedPhotosAlbum(self.image.image!, nil, #selector(ShowPhotoViewController.showSavedPhotoStatus), nil) })) alert.addAction(UIAlertAction(title: "Нет", style: .Cancel, handler: nil)) presentViewController(alert, animated: true, completion: nil) } 

    1 answer 1

    1) If you have the option to make sender optional (add?) @IBAction func longTap(sender: UILongPressGestureRecognizer?) , Then you can call self.longTap(nil)

    2) if not, you will have to generate an "artificial" tap for transfer to the method.

     let tap: UILongPressGestureRecognizer = UILongPressGestureRecognizer() self.longTap(tap)