If I register collectionViewCell in storyboard,it work well, but when I use a xib to create viewController,register collectionViewCell by code,it crash.

@IBDesignable
class EnterpriseUserCardCollectionViewCell: NibCollectionViewCell {
override func awakeFromNib() {
super.awakeFromNib()
self.contentView.layer.cornerRadius = 8
self.contentView.clipsToBounds = true
}
}
class TestCollectionViewController: UIViewController,UICollectionViewDataSource {
@IBOutlet weak var collectionView: UICollectionView!
override func viewDidLoad() {
super.viewDidLoad()
self.collectionView.dataSource = self
self.collectionView.register(UINib(nibName: "EnterpriseUserCardCollectionViewCell", bundle: .main), forCellWithReuseIdentifier: "EnterpriseUserCardCollectionViewCell")
}
func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 10
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "EnterpriseUserCardCollectionViewCell", for: indexPath)
return cell
}
}
If I register collectionViewCell in storyboard,it work well, but when I use a xib to create viewController,register collectionViewCell by code,it crash.