I connected the UILabel
and UIButton
but is still aborts. Please help me fix this.
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
counterLabel.text = "0"
// Do any additional setup after loading the view, typically from a nib.
}
var counterNum: Int = 0
@IBOutlet weak var counterLabel: UILabel!
@IBAction func Tap(_ sender: UIButton) {
self.counterNum += 1
self.counterLabel.text = String(self.counterNum)
}
}