I ask for help with determining the right approach
when I click on the picture I need to pass text and her to new VC, but the problem is that the project has a great depth struct
the cell lies in the collectionView
, which is in the tableViewCell
How do I properly implement the transfer? (the number of cells is generated automatically)
Another complication is that the code of the cell with which I work lies in another cell.
those. the transfer of information must also be written in it.
import UIKit
import moa
class RealPhotoInfoTableViewCell: UITableViewCell {
@IBOutlet private weak var MyCollection: UICollectionView!
var model: RealPhoto!
func setCollectionViewDataSourceDelegate(dataSourceDelegate: UICollectionViewDataSource & UICollectionViewDelegate, forRow row: Int) {
MyCollection.delegate = self
MyCollection.dataSource = self
MyCollection.reloadData()
}
}
extension RealPhotoInfoTableViewCell: UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
print(model?.data.count as Any)
return model?.data.count ?? 0
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "RPhotoCell", for: indexPath) as! RealPhotoCollectionViewCell
cell.realPhotoImage.moa.url = model?.data[indexPath.row].photo
return cell
}
}