Я пытаюсь получить 2 изображения подряд, как на скриншоте.
![What result I want](https://i.stack.imgur.com/dfQwC.jpg)
but this is my real result
мой реальный результат
вот мое расширение ViewController:
extension ViewController : UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return images.count // images is an array of my UIImages`s
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellImage", for: indexPath) as! imageCollectionViewCell
cell.imageView.image = images[indexPath.item]
cell.imageView.contentMode = .scaleAspectFill
cell.imageView.clipsToBounds = true
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let frameCV = collectionView.frame//размер collectionView
let cellWidth = frameCV.width / CGFloat(countOfCells) // countOfCells == 2
let cellHeight = cellWidth
return CGSize(width: cellWidth, height: cellHeight)
}
}