Skip to content

Instantly share code, notes, and snippets.

@fisherds
Last active January 2, 2018 17:09
Show Gist options
  • Select an option

  • Save fisherds/e748466f9bc01f11dfbd to your computer and use it in GitHub Desktop.

Select an option

Save fisherds/e748466f9bc01f11dfbd to your computer and use it in GitHub Desktop.
Code added in this video to implement the ButtonsAndLabelsViewController
import UIKit
class ButtonsAndLabelsViewController: UIViewController {
var counter = 0;
@IBOutlet weak var countLabel: UILabel!
@IBAction func pressedIncrement(_ sender: Any) {
counter += 1
updateView()
}
@IBAction func pressedDecrement(_ sender: Any) {
counter -= 1
updateView()
}
func updateView() {
countLabel.text = "Count = \(counter)"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment