The variable latitude in ViewController1 is visible. Why is the variable from another ViewController empty? Whenever I run the code the .text
property of ActualCoordinatesText
label is empty...
class ViewControllerGpsMaps: UIViewController {
@IBOutlet weak var ActualCoordinatesText: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
}
@IBAction func GetCoordinates(_ sender: Any) {
GetActualCoordinates()
}
public func GetActualCoordinates() {
let sb = storyboard?.instantiateViewController(withIdentifier: "ViewController1") as! ViewController
ActualCoordinatesText.text = sb.latitude
}
}
Thanks for the help!