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

store cgpoint in userdefaults iOS swift