diff --git a/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift b/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift index 12d08bf7..d15b34a3 100644 --- a/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift +++ b/VDS/Components/Buttons/ButtonGroup/ButtonGroup.swift @@ -87,7 +87,6 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega } } - //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- @@ -148,7 +147,6 @@ open class ButtonGroup: View, UICollectionViewDataSource, UICollectionViewDelega let button = buttons[indexPath.row] let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "collectionViewCell", for: indexPath) cell.subviews.forEach { $0.removeFromSuperview() } - cell.subviews.forEach { $0.removeFromSuperview() } cell.addSubview(button) button.pinToSuperView() return cell diff --git a/VDS/Components/Buttons/ButtonGroup/ButtonGroupPositionLayout.swift b/VDS/Components/Buttons/ButtonGroup/ButtonGroupPositionLayout.swift index c2d6b74a..1a017135 100644 --- a/VDS/Components/Buttons/ButtonGroup/ButtonGroupPositionLayout.swift +++ b/VDS/Components/Buttons/ButtonGroup/ButtonGroupPositionLayout.swift @@ -68,7 +68,8 @@ class ButtonGroupPositionLayout: UICollectionViewLayout { super.prepare() itemCache.removeAll() - + layoutHeight = 0.0 + guard let collectionView = collectionView else { return } @@ -129,8 +130,6 @@ class ButtonGroupPositionLayout: UICollectionViewLayout { } override func layoutAttributesForElements(in rect: CGRect)-> [UICollectionViewLayoutAttributes]? { - super.layoutAttributesForElements(in: rect) - var visibleLayoutAttributes: [UICollectionViewLayoutAttributes] = [] for attributes in itemCache { @@ -143,7 +142,6 @@ class ButtonGroupPositionLayout: UICollectionViewLayout { } override func layoutAttributesForItem(at indexPath: IndexPath) -> UICollectionViewLayoutAttributes? { - super.layoutAttributesForItem(at: indexPath) return itemCache[indexPath.row] } @@ -158,10 +156,5 @@ class ButtonGroupPositionLayout: UICollectionViewLayout { let insets = collectionView.contentInset return collectionView.bounds.width - (insets.left + insets.right) } - - override func shouldInvalidateLayout(forBoundsChange newBounds: CGRect) -> Bool { - layoutHeight = 0.0 - return true - } }