Nauman Ahmad Nauman Ahmad - 2 years ago 94
Swift Question

Can't pass data to another view controller in when preparing for segue

I am trying to pass an object to another view controller but I get an error when I try to set the property of the view controller object.

error_xcode

Answer Source

The error is pretty informative. It says the class ViewController has no public or internal property called data. You'll have to declare a property called data in class ViewController.

class ViewController: UIViewController {

  var data: String?

}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download