iOS: A simple counter

This entry is part 4 of 32 in the series iOS Apps

This is another tutorial that I found that will be suitable for us to learn iOS programming with swift.

Below here the code that was used.

import UIKit

class ViewController: UIViewController {
    @IBOutlet var outputLabel: UILabel!
    var currentCount = 0

    override func viewDidLoad() {
        // Do any additional setup after loading the view, typically from a nib.

    override func didReceiveMemoryWarning() {
        // Dispose of any resources that can be recreated.
    @IBAction func addOneButton(sender: UIButton) {
        currentCount = currentCount + 1
        outputLabel.text = "The button has been clicked \(currentCount) no of times"
        outputLabel.textColor = UIColor.redColor()
Series Navigation<< iOS: First App from Apple
iOS: A Quick Tour of the Interface >>

Leave a comment

Leave a Reply