IGListKit icon indicating copy to clipboard operation
IGListKit copied to clipboard

Unable to Utilize SizeForItem and CellForItem Function

Open phonix-dev opened this issue 2 years ago • 1 comments

New issue checklist

  • [X] I have reviewed the README and documentation
  • [X] I have searched existing issues and this is not a duplicate
  • [X] I have attempted to reproduce the issue and include an example project.

General information

  • IGListKit version:
  • iOS version(s):
  • CocoaPods/Carthage version:
  • Xcode version:
  • Devices/Simulators affected:
  • Reproducible in the demo project? (Yes/No):
  • Related issues:

Debug information

# Please include debug logs using the following lldb command:
po [IGListDebugger dump]

I'm still having a weird bug. Everything compiles and runs but CellForItem(at index: Int) && sizeForItem(at index: Int) aren't working within ListSectionControllers. I put breakpoints on numberOfItems() function and can see that is working but the rest are not responding

phonix-dev avatar Mar 27 '22 00:03 phonix-dev

I figured out the issue, for anyone else needing help regarding this topic, Here's the what fixed the bug for me: external documentation provided this initialization format for UICollectionView

    public var collectionView: UICollectionView = {
        return UICollectionView(
            frame: .zero,
            collectionViewLayout: UICollectionViewFlowLayout()
        )
    }()

It was hard to catch this error because this worked normally until i had to cut and divide my code piece by piece to trace inconsistencies with a test project that worked. (I do not know why this didn't work because it seems like the standard procedure in initializing views) I referred to a direct method of initializing UICollectionView

    public var collectionView = UICollectionView(
        frame: .zero,
        collectionViewLayout: UICollectionViewFlowLayout()
    )

and that worked for me.

Also your adapter should be a class property incase you missed that, that could be a possible bug Please refer to link for more info on the bug related to "adapter and class property"

popoolasubomi avatar Mar 27 '22 19:03 popoolasubomi