devxoul / Then

✨ Super sweet syntactic sugar for Swift initializers
MIT License
4.16k stars 290 forks source link

UICollectionView doesn't show cells #63

Closed TaeJoongYoon closed 5 years ago

TaeJoongYoon commented 5 years ago
image

If I create a UICollectionView with upside code, it works good. However, I create UICollectionView with downside code, it doesn`t show cells. Others code all same.

What's the problem??

devxoul commented 5 years ago

You have to use UICollectionView's designated initializer.

let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()).then {
  $0.translatesAutoresizingMaskIntoConstraints = false
  $0.register(Reusable.flickrCell)
}
TaeJoongYoon commented 5 years ago

Thank you!

I did it like your code... but it was not working...

It's nice now, I don't know why 😂😂 perhaps it's my fault.