iOS: A simple counter

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() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
    }

    override func didReceiveMemoryWarning() {
        super.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 >>