This commit is contained in:
Pfeil, Scott Robert 2020-04-08 16:16:16 -04:00
parent 8c9ab45951
commit 9178385e6d

View File

@ -148,6 +148,7 @@ import Foundation
/// Should be used to refresh the layout of the collection view. Updates flexible padding.
open func invalidateCollectionLayout() {
self.collectionView?.collectionViewLayout.invalidateLayout()
// TODO: Improve this workaround (autolayout for cells happens async so contentSize isn't accurate immediately)
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1, execute: {
self.updateFlexibleSpace()
})
@ -156,6 +157,7 @@ import Foundation
/// Should be used to reload the data of the collection view. Updates flexible padding.
open func reloadCollectionData() {
collectionView?.reloadData()
// TODO: Improve this workaround (autolayout for cells happens async so contentSize isn't accurate immediately)
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.1, execute: {
self.updateFlexibleSpace()
})