I searched the Internet many times and did not find a solution for my situation. Things that might be the solution is something that I did not understand, and they were in Objective-C. So if it is a duplicate, it is not. I could not find a solution from other posts.
I make a GPA calculator specifically for my school, where we get different points depending on our levels.
I made a UITableView with a custom cell that will be duplicated a certain number of times for each item in the class.
What I want to know is getting data from each of these user cells (grade and level)
So this is my storyboard:

and this is my application viewed in the simulator:

I am going to get a grade and level by getting the text of the labels for each topic, and I have no idea how to get data from certain cells.
Many thanks.
Here is the code that I have:
But I get an error when arrays never received values. can someone help?
EDIT:
I got an error again, so I tried to manually pass strings to arrays, and its initialization, for example
var levels: [String] = ["H", "H", "H", "H", "H", "H"] var scores: [String] = ["12", "23", "34", "45", "56", "67"]
and the program worked perfectly. Thus, it is concluded that the problem arises in the part where the array receives strings that
func tableView(tableView: UITableView!, didDeselectRowAtIndexPath indexPath: NSIndexPath!) { let cell = tableView.cellForRowAtIndexPath(indexPath) as customCell var level: String! = cell.showStepperValueLabel.text var score: String! = cell.showSliderValueLabel.text levels.insert(level, atIndex: indexPath.row) scores.insert(level, atIndex: indexPath.row) }
Are you sure the selection is correct? everyone else on the internet taught me how to use tags, but didn't tell me how to use it ...
EDIT2:
so I tried to use tags. this is what i wrote in the tableView function: cellForRowAtIndexPath
cell.showStepperValueLabel.tag = indexPath.row+10 cell.showSliderValueLabel.tag = indexPath.row
and this is what i wrote in prepareForSegue file
var engScore : UILabel! = self.view.viewWithTag(0) as? UILabel var mathScore: UILabel! = self.view.viewWithTag(1) as? UILabel var sciScore: UILabel! = self.view.viewWithTag(2) as? UILabel var geoScore: UILabel! = self.view.viewWithTag(3) as? UILabel var hisScore: UILabel! = self.view.viewWithTag(4) as? UILabel var chiScore: UILabel! = self.view.viewWithTag(5) as? UILabel var engLevel: UILabel! = self.view.viewWithTag(10) as? UILabel var mathLevel: UILabel! = self.view.viewWithTag(11) as? UILabel var sciLevel: UILabel! = self.view.viewWithTag(12) as? UILabel var geoLevel: UILabel! = self.view.viewWithTag(13) as? UILabel var hisLevel: UILabel! = self.view.viewWithTag(14) as? UILabel var chiLevel: UILabel! = self.view.viewWithTag(15) as? UILabel
so in the GPA calculation function I set
//Get pxcs engpxc = engCredits*co.getEnglishPoints(engLevel.text!, engScore: engScore.text!) mathpxc = mathCredits*co.getNonLanguagePoints(mathLevel.text!, scoreRecieved: mathScore.text!) geopxc = geoCredits*co.getNonLanguagePoints(geoLevel.text!, scoreRecieved: geoScore.text!) hispxc = hisCredits*co.getNonLanguagePoints(hisLevel.text!, scoreRecieved: hisScore.text!) scipxc = sciCredits*co.getNonLanguagePoints(sciLevel.text!, scoreRecieved: sciScore.text!) chipxc = chiCredits*co.getChiPoints(chiLevel.text!, chiScore: chiScore.text!) //
and now I get an error
Fatal error: Zero unexpectedly found while deploying optional value (Lldb)
can someone help me with this?
EDIT3 - Additional Information:
I added println to tableView: cellForRowAtIndexPath in the parts where I give the tags, and found out that the tags were sent successfully, and these tags got the tags that I assigned in the program, however, when I checked with println in the prepareForSegue function in where variables get their views to see if they got shortcuts, but I got "zero". What is the problem?