массив с фото в UICollectionView на весь экран по тапу и свайпать эти фото

У меня есть uicollectionview с массивом фото, как сделать, чтобы по тапу на фото она открывалась на весь экран и по свайпу переходила к следующему фото?

import UIKit

class FriendPhotoCollectionViewController: UICollectionViewController {

var friend: [UIImage]?

override func viewDidLoad() {
super.viewDidLoad()


}

override func numberOfSections(in collectionView: UICollectionView) -> Int {
// #warning Incomplete implementation, return the number of sections
return 1
}

//кол-во ячеек в коллекции
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
// #warning Incomplete implementation, return the number of items
return friend!.count
}
//добавляем массив фото в коллекцию
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "PhotoCell", for: indexPath) as! FriendPhotoCollectionViewCell
cell.photosFriend.image = friend![indexPath.row]

return cell
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "goPhoto"
{
// Даём понять, что sender это ячейка класса MyCell
let cell: FriendPhotoCollectionViewCell = sender as! FriendPhotoCollectionViewCell

// Получает объект image из текущей ячейки
let image = cell.photosFriend.image

// Даём понять, что destinationViewController это контроллер класса PreviewVC
let previewVC: SinglePhotoViewController = segue.destination as! SinglePhotoViewController

// Задаём контроллеру изображение с текущей ячейки
previewVC.images = image
}
}
}

import UIKit

class SinglePhotoViewController: UIViewController {

var images: UIImage!
@IBOutlet weak var imageViewPreview: UIImageView!



override func viewDidLoad() {
super.viewDidLoad()

}

override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)

self.imageViewPreview.image = images
}
}



Ответы (0 шт):