Search code examples
swiftswift3uicollectionviewswift4uicollectionviewlayout

sizeForItemAtIndexPath is not found in different swift versions


I am using UICollectionView but following method not found:

 func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize

please suggest me it's replacement.


Solution

  • This is the new syntax for that:

    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
    
    }