I have been making simple GPA calculation app. and it takes user input from lot of text fields and do the calculate and show the result.i want to show that result in 2ndViewController
@IBAction func CalculateGpa(sender: AnyObject){
//all the calculation happen here
//example
let gpa:Float = TotalGiCi/TotalGi
}
and i want to pass that gpa to my 2ndViewController label.
so i did the coding like this
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
var ResultViewController : ViewControllerResult = segue.destinationViewController as! ViewControllerResult
ResultViewController.GPAResultLabel = "\(gpa)"
}
Then i got the error saying Use of unresolved identifier gpa
what i can do here?
i tried removing @IBAction func CalculateGpa(sender: AnyObject){ and replacing it with override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { because sender is anyObject. then i got error
unrecognized selector sent to instance
gpa = TotalGiCi/TotalGi!errorcannot assign 'gpa' inself``let gpa:Floatand inside @IBActiongpa = TotalGiCi/TotalGiam i doing right?