Iglistkit: Enhancement: IGListSectionController usable size

Created on 22 Dec 2016  路  2Comments  路  Source: Instagram/IGListKit

Hello,

I often have to write the following code while calculating sizes for the cells in my IGListSectionController:

public func sizeForItem(at index: Int) -> CGSize {
   let width = collectionContext!.containerSize.width - inset.left - inset.right
   let height = collectionContext!.containerSize.width - inset.top - inset.bottom 
   [...]

that I think it would actually be a nice addition to the framework.

I was thinking about a property on IGListSectionController called like usableSize, visibleSize, paddedSize (or something better :D)

  var visibleSize: CGSize {
    guard let context = collectionContext else { return CGSize() }
    return CGSize(width: context.containerSize.width - inset.left - inset.right,
                  height: context.containerSize.width - inset.top - inset.bottom)
  }

I would like to know if this is something that would the community be interested to add

duplicate enhancement

Most helpful comment

Hi @jessesquires ! It is :D UPS!
I read the other issues but I haven't noticed that it was the same thing ahah.

I am going to close this one.

On a separate note (which I cannot test and raise as a issue right now)
I am also going to try again to test on my project as soon as I get around with a iOS 9 phone,
since last time I tested the Framework on iOS 9 I noticed that the insets of the IGListSectionController are not applied correctly. (I think due to the internal changes on how the collectionView is layed out between iOS 9 and iOS 10)

Thanks

All 2 comments

Thanks @racer1988 ! 馃槃

Is this the same as #315?

Hi @jessesquires ! It is :D UPS!
I read the other issues but I haven't noticed that it was the same thing ahah.

I am going to close this one.

On a separate note (which I cannot test and raise as a issue right now)
I am also going to try again to test on my project as soon as I get around with a iOS 9 phone,
since last time I tested the Framework on iOS 9 I noticed that the insets of the IGListSectionController are not applied correctly. (I think due to the internal changes on how the collectionView is layed out between iOS 9 and iOS 10)

Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shuhrat10 picture shuhrat10  路  3Comments

runmad picture runmad  路  3Comments

alexwillrock picture alexwillrock  路  3Comments

PhilCai1993 picture PhilCai1993  路  3Comments

rnystrom picture rnystrom  路  3Comments