Первое:
Возвращенное значение numberOfItemsInSection
будет array.count
для Примера
var array = [model]()
Затем в cellForItemAt
вы должны сконфигурировать свою ячейку с данными, поэтому добавьте этот блок в свой класс ячеек.
func configureCell(_ data: model) {
// code for cell view
}
Наконец cellForItemAt
будет
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! UICollectionViewCell
cell.configureCell(array[indexPath.item])
return cell
}
Надеюсь, это будет полезно для вас.