UItableviewcell and UICollectionviewCell get the name based on nib and reusable identifier iOS swift

 Solution:

// MARK: UITableViewCell

extension  UITableViewCell {

    static var nib:UINib{

        return UINib(nibName: identifier, bundle: nil)

    }

    static var identifier: String {

        return String(describing: self)

    }

}


// MARK: UICollectionViewCell

extension  UICollectionViewCell {

    static var nib:UINib{

        return UINib(nibName: identifier, bundle: nil)

    }

    

    static var identifier: String {

        return String(describing: self)

    }

}

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift