1

I'm working with UICollectionViewController. At some point In need to make some configurations to the visible footers and for each one of them, I need to know its' current section number. Current because sections may be replaced and the section of a reusable view may change.

self.collectionView.visibleSupplementaryViews(ofKind: UICollectionView.elementKindSectionFooter)
    .filter { $0.reuseIdentifier == reuseIdentifierFooter}
    .forEach {
        // Here I need to know the section number of each view
}
Sanich
  • 1,739
  • 6
  • 25
  • 43

1 Answers1

1

Get the index path for the visible views: https://developer.apple.com/documentation/uikit/uicollectionview/1618034-indexpathsforvisiblesupplementar

Then iterate through the indexPaths and query the view with https://developer.apple.com/documentation/uikit/uicollectionview/1618041-supplementaryview

Cyberbeni
  • 660
  • 4
  • 15