How to access points
property from IBAction method of ViewController
and pass it to scoreLabel
of SecondViewController
?
import UIKit
class ViewController: UIViewController {
var points: Int = 0
@IBAction func action(sender: UIButton) {
points += 1
}
}
class SecondViewController: UIViewController {
@IBOutlet weak var scoreLabel: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
}
}