Updating a integer as a label in swift
Updating a integer as a label in swift I want to change the number value of a label by pressing a button. I used to get errors saying you can't put a number in a string, so, I did string(variable). It now displays the basic number, 1, but when I click it, it doesn't update! Here is how I set up the variable: First, I set up the button, to IBAction. Here is the code inside of it: @IBOutlet weak var NumberOfExploits: UILabel! @IBAction func exploiter(sender: AnyObject) { var hacks = 0 hacks += 1 NumberOfExploits.text = String(hacks) } Can someone help be find out how to get it to change numbers? variable += 1 except second line? – SwiftStudier Aug 29 '15 at 17:20 3 Answers 3 First: let is used for constants, these can not be chan...