I am passing data from one class to another, and I am receiving nil values when I breakpoint and look at the console.
This is the class with the values, and I want to pass these values to the class viewc
func viewControllerAtIndex(index: Int) -> viewc {
if ((self.namepage.count == 0) || (index >= self.namepage.count) {
return viewcard()
}
var vc: viewc = self.storyboard?.instantiateViewControllerWithIdentifier("ItemController") as! viewc
vc.imageFile = self.pageImages[index] //not nil
vc.cTitle = self.namepage[index] //not nil
vc.nTitle = self.numberpage[index] //not nil
vc.pageIndex = index
vc.getArray()
return vc
}
This class is the class I want to pass the data to.
class viewc: UIViewController{
var pageIndex: Int!
var cTitle: String!
var imageFile: String!
var nTitle: String!
@IBOutlet weak var imagen: UIImageView!
@IBOutlet weak var name: UILabel!
@IBOutlet weak var number: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
}
func getArray() {
self.imagen.image = UIImage(named: self.imageFile)//imageFile is nil
self.name.text = self.cTitle//cTitle is nil
self.number.text = self.nTitle//nTitle is nil
}
}