I retrieved my data using firebase database into a table view cell in a view controller. I want to forward the data to another view controller. enter image description here i try by creating variables assigning them to table view cells label but when trying to retrieve the app crashed enter image description here . here are my sample codes enter image description here
This function expects an Any
as parameter, so in your function didSelectRowAt
you can get the object using the index atIndexPath
getting the object from the array you used to populate the tableView
and send this object in the sender
parameter:
performSegue(withIdentifier: String, sender: Any?)
You should then implement this function:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?)
There you can retrieve your object in the sender
and the view controller in the property segue.destination
which is a UIViewController
so you can convert it to your ViewController and pass the object to the next one.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.