Search code examples
iosswiftibaction

Return value from function (action button)


Does anyone know how can I get o return a value from this function? I want to return t , the value is a image Pd. I want to return the value in this viewcontroller

@IBAction func firmaButton(_ sender: Any)  {
  let storyBoard1 : UIStoryboard = UIStoryboard(name: "NuevaCuenta", bundle: nil)
  let ViewControllerDos1 = storyBoard1.instantiateViewController(withIdentifier: "NCFirma") as! NCFirma
  ViewControllerDos1.modalPresentationStyle = .fullScreen

    ViewControllerDos1.clickedCallback = { t   in
        self.firmaButton.setImage(t, for: .normal)
        self.firmaButton.transform = self.firmaButton.transform.rotated(by: CGFloat(M_PI_2))
        self.firmaButton.frame =  CGRect(x: 13, y: 8, width: 294, height: 112)
        self.firmaButton.clipsToBounds = true
        RegTempNuevaCuenta.imgFirma = t
        let appDelegate = UIApplication.shared.delegate as! AppDelegate
        appDelegate.myOrientation = .portrait

    }

    self.navigationController?.pushViewController(ViewControllerDos1, animated: true)



}

Solution

  • @IBAction function is system based functions based on user interaction. They don't return anything and the return type is Void for this type function