I have 2 ViewControllers and depending on the button I press on my FirstViewController I would like to display a text on the SecondViewController.
On the FirstViewController.swift I have this:
var labelsText = String()
@IBAction func Button1(_ sender: UIButton) {
labelsText = "test1"
}
@IBAction func Button2(_ sender: UIButton) {
labelsText = "test2"
}
On the SecondViewController.swift I have this:
@IBOutlet var Label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
Label.text = FirstViewController.labelsText
I always get this error message:
Instance member 'labelsText' cannot be used on type 'FirstViewController'; did you mean to use a value of this type instead?