I am trying to update the footer (optional element). I use the -invalidatelayout method. Based on SO suggestions here . Apple documentation here . I get the following error:
*** Application termination due to the uncaught exception "NSInvalidArgumentException", reason: "invalid context () sent - [UICollectionViewFlowLayout invalidateLayoutWithContext:] is not an instance of type UICollectionViewFlowLayoutInvalidationContext or subclass"
let footer_context = UICollectionViewLayoutInvalidationContext()
footer_context.invalidateSupplementaryElements(ofKind: "ActivitiesSelectMembersFooterView", at: [indexPath])
self.collectionView?.collectionViewLayout.invalidateLayout(with: footer_context)
It looks like the invalidateLayout method expects a UICollectionViewFlowLayoutInvalidationContext instead of a UICollectionViewLayoutInvalidationContext.
I am using Xcode 8 and Swift 3.
My storyboard in Xcode is here -

Next is a footer that has a custom class called ActivitiesSelectMembersFooterView
source
share