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

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift