Created
November 13, 2025 09:14
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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