I am trying to pass data from a PFTableViewCell to my next view controller(details) but I am still not able to see the data. I think wrote my code correctly for Swift 2.0/Xcode 7. I've been stuck on this for about 2 weeks and I'm not good with coding at all. Is there any other code that could pass the data to other viewcontroller?
In my FirstViewController I have this code written:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "Detail" {
if let destination = segue.destinationViewController as? DetailsViewController
, path = tableView?.indexPathForSelectedRow
, cell = tableView?.cellForRowAtIndexPath( path ) as? Post
{
destination.name = cell.name.text ?? "nil"
destination.message = cell.message.text ?? "nil"
}
and in my DetailsViewController I have this written:
var name: String?
var message: String?
@IBOutlet weak var userName: UILabel?
@IBOutlet weak var userMessage: UILabel?
override func viewDidLoad()
{
super.viewDidLoad()
userName?.text = name ?? "nil"
userMessage?.text = message ?? "nil"
}