В основном UITableViewController:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "idCell", for: indexPath)
cell.viewController = self
}
В классе UITableViewCell:
class TableViewCell: UITableViewCell {
weak var viewController: UIViewController?
@IBAction func linkAction(_ sender: Any) {
let linkString = self.linkText.text
if let requestUrl = URL(string: linkString!) {
let safariVC = SFSafariViewController(url: requestUrl)
viewController?.present(safariVC, animated: true, completion: nil)
}
}
}