-3

I would try to set to the collection view on the same view controller, but at runtime it shows the error of signal SIGABRT error so please tell me what can I do to add to the collection view on the same view controller?

Eric Aya
  • 69,473
  • 35
  • 181
  • 253
Siddharth Shah
  • 382
  • 4
  • 22

1 Answers1

2

You can add two collection view in a single view controller by dragging it.

but you have to validate UIcollection view like

func collectionView(collectionView: UICollectionView,
        cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {  
    var cell = HomeCollectionViewCell()

if(collectionView == self.collName1)
            {  
    cell = collName.dequeueReusableCellWithReuseIdentifier("CellIdentifier", forIndexPath: indexPath) as! HomeCollectionViewCell  
}  
else  
if(collectionView == self.collName2)  
{}     
return cell
}   
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
Vivek Gajbe
  • 411
  • 2
  • 14