Swift/UITableView

[SWIFT]UITableViewCell Extention IndexPath 구하기

삽질중 2023. 4. 26. 15:49
extension UITableViewCell{
    
    func getIndexPath() -> IndexPath? {
        guard let superView = self.superview as? UITableView else {
            return nil
        }
        let indexPath = superView.indexPath(for: self)
        return indexPath
    }
}