Skip to content

Instantly share code, notes, and snippets.

@nolili
Created September 11, 2014 13:56
Show Gist options
  • Select an option

  • Save nolili/63d991fd0df8b9fb3920 to your computer and use it in GitHub Desktop.

Select an option

Save nolili/63d991fd0df8b9fb3920 to your computer and use it in GitHub Desktop.
Counter-Swift
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var display: UILabel?
@IBAction func add(sender: UIButton) {
count++
}
var count:Int = 0 {
didSet {
display?.text = String(count)
}
}
override func viewDidLoad() {
super.viewDidLoad()
count = 0;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment