diff --git a/.github/workflows/env.properties b/.github/workflows/env.properties index b0c32f84..32f85346 100644 --- a/.github/workflows/env.properties +++ b/.github/workflows/env.properties @@ -1,3 +1,3 @@ -xcode_version=16.2 +xcode_version=16.4 TUIST_TEST_DEVICE=iPhone SE (3rd generation) TUIST_TEST_PLATFORM=iOS diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 9b72fbb1..5000cd4b 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -46,8 +46,8 @@ jobs: - name: Switch to Xcode ${{ env.xcode_version }} run: sudo xcode-select -s /Applications/Xcode_${{ env.xcode_version }}.app - - name: Install xcodes - run: brew install aria2 xcodesorg/made/xcodes + - name: Install aria2 + run: brew install aria2 - name: Install iOS ${{ matrix.sdk }} if: ${{ matrix.installation_required }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 621245a4..ba508e0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Fixed +- Fixed an issue where animations would occur when dequeuing / reusing cells. A layout is now forced without animation before presentation. + ### Added ### Removed diff --git a/Development/Sources/Demos/Demo Screens/AnimatedReuseViewController.swift b/Development/Sources/Demos/Demo Screens/AnimatedReuseViewController.swift deleted file mode 100644 index cc52afe6..00000000 --- a/Development/Sources/Demos/Demo Screens/AnimatedReuseViewController.swift +++ /dev/null @@ -1,39 +0,0 @@ -// -// AnimatedReuseViewController.swift -// Demo -// -// Created by Kyle Van Essen on 8/9/24. -// Copyright © 2024 Kyle Van Essen. All rights reserved. -// - -import BlueprintUILists -import BlueprintUICommonControls - - -final class AnimatedReuseViewController : ListViewController { - - - override func configure(list: inout ListProperties) { - - list.add { - Section("items") { - for row in 1...1000 { - ToggleRow(isOn: .random(), identifierValue: row) - } - } - } - } - - private struct ToggleRow : BlueprintItemContent, Equatable { - - var isOn: Bool - var identifierValue: AnyHashable - - func element(with info: ApplyItemContentInfo) -> any Element { - Toggle(isOn: isOn) { _ in } - .centered() - .inset(uniform: 10) - } - - } -} diff --git a/Development/Sources/Demos/Demo Screens/CollectionViewAppearance.swift b/Development/Sources/Demos/Demo Screens/CollectionViewAppearance.swift index a134d433..d1108757 100644 --- a/Development/Sources/Demos/Demo Screens/CollectionViewAppearance.swift +++ b/Development/Sources/Demos/Demo Screens/CollectionViewAppearance.swift @@ -270,7 +270,7 @@ struct Toggle : Element { config.apply { toggle in if toggle.isOn != self.isOn { - toggle.setOn(self.isOn, animated: true) + toggle.setOn(self.isOn, animated: UIView.inheritedAnimationDuration > 0.0) } toggle.onToggle = self.onToggle } diff --git a/Development/Sources/Demos/DemosRootViewController.swift b/Development/Sources/Demos/DemosRootViewController.swift index 7c348aee..ea28664c 100644 --- a/Development/Sources/Demos/DemosRootViewController.swift +++ b/Development/Sources/Demos/DemosRootViewController.swift @@ -351,7 +351,7 @@ public final class DemosRootViewController : ListViewController DemoHeader(title: "Other Layouts") } - Section("testing") { [weak self] in + Section("fuzzing") { [weak self] in Item( DemoItem(text: "Fuzz Testing"), @@ -368,16 +368,8 @@ public final class DemosRootViewController : ListViewController self?.push(SupplementaryTestingViewController()) } ) - - Item( - DemoItem(text: "Verify Reuse Has No Animation"), - selectionStyle: .selectable(), - onSelect : { _ in - self?.push(AnimatedReuseViewController()) - } - ) } header: { - DemoHeader(title: "Testing") + DemoHeader(title: "Fuzz Testing") } Section("selection-state") { diff --git a/ListableUI/Sources/ListView/ListView.Delegate.swift b/ListableUI/Sources/ListView/ListView.Delegate.swift index 4b50d90f..c666231c 100644 --- a/ListableUI/Sources/ListView/ListView.Delegate.swift +++ b/ListableUI/Sources/ListView/ListView.Delegate.swift @@ -147,6 +147,13 @@ extension ListView item.willDisplay(cell: cell, in: collectionView, for: indexPath) self.displayedItems[ObjectIdentifier(cell)] = item + + UIView.performWithoutAnimation { + /// Force a layout of the cell before it is displayed, so that any implicit animations + /// are avoided. This ensures that cases like toggling a switch on and off are + /// not animated as the cell comes into view. + cell.layoutIfNeeded() + } } func collectionView( @@ -182,6 +189,13 @@ extension ListView headerFooter.collectionViewWillDisplay(view: container) self.displayedSupplementaryItems[ObjectIdentifier(container)] = headerFooter + + UIView.performWithoutAnimation { + /// Force a layout of the cell before it is displayed, so that any implicit animations + /// are avoided. This ensures that cases like toggling a switch on and off are + /// not animated as the cell comes into view. + container.layoutIfNeeded() + } } func collectionView(