I am trying to display pre-coded Page/View cells onto their respective cells in my collection view controller.
I've created all the pages without the use of storyboards.
I've created 3 cells but now I am trying to figure out how to put each view into their respective view. I created an array of my 3 classes(pages) but can't figure out how to connect them to separate cells in "cellForItemAt" I tried playing with indexPaths and collectionview.cellForItem(at: ___) but I haven't been able to achieve what I want.
How can I go about connecting the pages in my array to the right cells?
Thanks
let pages = [AboutPageCell, MainPageCell, InfoPageCell]
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 3
}
override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cellId", for: indexPath)
return cell
}