UICollectionViewController Error in Swift 3.0: must be initialized with a non-nil layout parameter

后端 未结 5 840
清酒与你
清酒与你 2021-01-14 08:03

I\'m new to iOS development. I\'ve been learning Swift, and today, I tried using UICollectionViewController.

My code is as follows:

 class ViewContro         


        
5条回答
  •  离开以前
    2021-01-14 08:16

    This should work:

    lazy var collectionView: UICollectionView = {
         let layout = UICollectionViewFlowLayout()
         let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
         return collectionView
    }()
    

提交回复
热议问题