Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Utilize SizeForItem and CellForItem Function #1558

Open
3 tasks done
phonix-dev opened this issue Mar 27, 2022 · 1 comment
Open
3 tasks done

Unable to Utilize SizeForItem and CellForItem Function #1558

phonix-dev opened this issue Mar 27, 2022 · 1 comment

Comments

@phonix-dev
Copy link

New issue checklist

  • I have reviewed the README and documentation
  • I have searched existing issues and this is not a duplicate
  • 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

@popoolasubomi
Copy link

popoolasubomi commented Mar 27, 2022

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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants