Here is the code, I\'m trying to make a simple calculator :
@IBAction func btnOperatorInput(sender: UIButton) {
let op = (\"+\", \"-\", \"*\", \"/\")
The error is easily solved, you need to access the String
's CharacterView
:
for _ in op.0.characters {
self.calc.add(Int(nr1)!, secondNumber: Int(nr2)!)
}
Note: As another commenter has queried above, I'm not sure why you'd want to iterate over what will always be a single and predictable character but I guess this might just be example code.