Q:

Use Class / Struct in collectionCell inside collectionCell for future pass data

How do I properly load the array (image, image2, image3) images from my class Model in collectionCell?
The class itself Model looks like this:
class Model {

    var image: String
    var image2: String
    var image3: String
    var images: [String] = []
    var images2: [String] = []
    var images3: [String] = []
    var ref: FIRDatabaseReference!

    init(snapshot: FIRDataSnapshot) {
        ref = snapshot.ref
        let value = snapshot.value as! NSDictionary
        let snap = value["hall1"] as? NSDictionary
        let snap2 = value["hall2"] as? NSDictionary
        let snap3 = value["hall3"] as? NSDictionary
        image = snap?["qwerty"] as? String ?? ""
        image2 = snap2?["qwerty"] as? String ?? ""
        image3 = snap3?["qwerty"] as? String ?? ""
        if let post1 = snap as? [String: AnyObject] {
            for (_, value) in post1["images"] as! [String: AnyObject] {
                self.images.append(value as! String)
            }
        }
        if let post2 = snap2 as? [String: AnyObject] {
            for (_, value) in post2["images"] as! [String: AnyObject] {
                self.images2.append(value as! String)
            }
        }
        if let post3 = snap3 as? [String: AnyObject] {
            for (_, value) in post3["images"] as! [String: AnyObject] {
                self.images3.append(value as! String)
            }
        }
    }
}

In my collectionCell loaded only the first image, I basically understand why, as I understand it is due to the fact that sd_setImage does not display arrays (correct me if I'm wrong), but how to fix it can not figure out.
Code of the collectionCell:
class CollectionViewCell11: UICollectionViewCell, UICollectionViewDelegate, UICollectionViewDataSource {

    var imagess: [Model] = []
    @IBOutlet weak var collectionView: UICollectionView!

    var vc1: ViewController?

    override func awakeFromNib() {
        super.awakeFromNib()

        collectionView.delegate = self
        collectionView.dataSource = self
    }

    func collectionView(_ collectionView: UICollectionView, numb  erOfItemsInSection section: Int) -> Int {
        return imagess.count
}
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath) as! CollectionViewCell12
        cell.imageView.sd_setImage(with: URL(string: imagess[indexPath.item].image))

        return cell
    }
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        if vc1 != nil {

            let vc2 = vc1!.storyboard?.instantiateViewController(withIdentifier: "ViewController2") as! ViewController2

            vc2.photo = [imagess[indexPath.item]]

            let backItem = UIBarButtonItem()
            backItem.title = ""
            vc1!.navigationItem.backBarButtonItem = backItem

            vc1!.navigationController?.pushViewController(vc2, animated: true)
        }
    }
}

To use I need only the class Model, because it contains another array of images which I plan to display the next controller for scroll image.

A:

If your next ViewController is a child of this cell then you can pass the array on to it this way.
You write this in the viewDidLoad() of the next ViewController:
var newImagesArray: [Model] = []
if let parentVC = self.parent as? CollectionViewCell11 {
    newImagesArray = parentVC.imagess 
}

