Skip to content

Instantly share code, notes, and snippets.

@dterekhov
Created November 13, 2025 09:14
Show Gist options
  • Select an option

  • Save dterekhov/6b515592b4581b43d3dba57968e58b46 to your computer and use it in GitHub Desktop.

Select an option

Save dterekhov/6b515592b4581b43d3dba57968e58b46 to your computer and use it in GitHub Desktop.
UITableViewCell+UITableViewAccess: An easy access to the parent UITableView from its UITableViewCell #uikit #swift-api #real-project
import UIKit
extension UITableViewCell {
/// Search up the view hierarchy of the table view cell to find the containing table view
public var fw_tableView: UITableView? {
var table: UIView? = superview
while !(table is UITableView) && table != nil {
table = table?.superview
}
return table as? UITableView
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment