I was wondering how to pass data from a class that extends from UITableViewCell to a view controller? I have some outlets on a custom cell connected to the UITableViewCell class that I would like to access from my UIViewController class.
Prepareforsegue only works for passing data between two viewcontrollers, so that does not apply to this case. All of the answers I have found on stack (and in various corners of the web) are in objective-c and no longer apply to swift. I would really appreciate your help. Thanks.
Are you trying to access the UITableViewCell from the UIViewController where it is displayed? If so, you should be able to access the outlets from your UITableViewCell using the dot operator.
// Example In UIViewController
let customCell = UITableViewCell() // This is whatever your custom cell is
let objectFromCell = customCell.outlet
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.