I am trying to pass some string data to a viewcontroller using performSegueWithIdentifier
, but I get this error Cannot convert value of type 'AnyObject?'. Type(Aka'Optional<AnyObject>.Type) to expected argument type 'AnyObject?'
Even if I use sender:self
, it still does not work.
In the storyboard, the segue is made by dragging a segue from 1st to 2nd view controller.
@IBAction func resetPassword(sender: AnyObject) {
FIRAuth.auth()?.sendPasswordResetWithEmail(emailTextField.text!, completion: { (error) in
var customError = error?.localizedDescription
if error == nil {
let noError = "Click on the link received in the email"
self.emailTextField.text = ""
self.emailTextField.attributedPlaceholder = NSAttributedString(string: noError, attributes:[NSForegroundColorAttributeName: UIColor.blueColor()])
self.customErroSent = noError
performSegueWithIdentifier("fromSeventhToFifth", sender: AnyObject?)
//self.resetButtonOutlet.hidden = true
// self.emailTextField.hidden = true
} else {
self.emailTextField.text = ""
self.emailTextField.attributedPlaceholder = NSAttributedString(string:customError!, attributes:[NSForegroundColorAttributeName: UIColor.redColor()])
}
})
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "fromSeventhToFifth" {
if let destViewController = segue.destinationViewController as? FifthViewController {
destViewController.label.text = customErroSent
}
}
}
}