Nauman Ahmad Nauman Ahmad - 1 year ago 61
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.


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?