From 634bce5ccb1eeb768ce5f75c89e731d6cdb9c091 Mon Sep 17 00:00:00 2001 From: Kyle Van Essen Date: Sun, 3 Mar 2024 14:02:16 -0800 Subject: [PATCH 1/3] Get a repro for the reordering crash reported in #market-ios --- .../PaymentTypesViewController.swift | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Demo/Sources/Demos/Demo Screens/PaymentTypesViewController.swift b/Demo/Sources/Demos/Demo Screens/PaymentTypesViewController.swift index b5096309..2c690f2d 100644 --- a/Demo/Sources/Demos/Demo Screens/PaymentTypesViewController.swift +++ b/Demo/Sources/Demos/Demo Screens/PaymentTypesViewController.swift @@ -34,6 +34,20 @@ final class PaymentTypesViewController : ListViewController { self?.save(with: info) } + list += Section(SectionID.general) { section in + section.header = SectionHeader(title: SectionID.general.title) + + section += EmptyRow() + section += EmptyRow() + } + + list += Section(SectionID.allPaymentTypes) { section in + section.header = SectionHeader(title: SectionID.allPaymentTypes.title) + + section += EmptyRow() + section += EmptyRow() + } + list += Section(SectionID.main) { section in section.header = PaymentTypeHeader(title: SectionID.main.title) @@ -183,12 +197,16 @@ final class PaymentTypesViewController : ListViewController { } enum SectionID : Hashable { + case general + case allPaymentTypes case main case more case disabled var title : String { switch self { + case .general: return "General" + case .allPaymentTypes: return "All Payment Types" case .main: return "Main payment types" case .more: return "More payment types" case .disabled: return "Disabled payment types" @@ -197,6 +215,22 @@ final class PaymentTypesViewController : ListViewController { } } +fileprivate struct SectionHeader : BlueprintHeaderFooterContent, Equatable { + + var title : String + + var elementRepresentation: Element { + Label(text: title) { + $0.font = .systemFont(ofSize: 24.0, weight: .bold) + } + .inset(uniform: 15.0) + } + + var background: Element? { + Box(backgroundColor: .white) + } +} + fileprivate struct PaymentTypeHeader : BlueprintHeaderFooterContent, Equatable { var title : String From db9cb27379ec6d7f7ec194feb87c0bb44194c20d Mon Sep 17 00:00:00 2001 From: Kyle Van Essen Date: Sun, 3 Mar 2024 14:33:08 -0800 Subject: [PATCH 2/3] Fix a crash that could occur during cell reuse if a list contained different types of headers. The wrong ObjectIdentifier was being compared and stored. --- CHANGELOG.md | 2 ++ ListableUI/Sources/ListView/ListView.Delegate.swift | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a6d4ba2..9576e92f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Fixed +- Fixed an issue that could cause a crash during view reuse when the list contained different types of headers. + ### Added ### Removed diff --git a/ListableUI/Sources/ListView/ListView.Delegate.swift b/ListableUI/Sources/ListView/ListView.Delegate.swift index c625009e..66a39143 100644 --- a/ListableUI/Sources/ListView/ListView.Delegate.swift +++ b/ListableUI/Sources/ListView/ListView.Delegate.swift @@ -186,7 +186,7 @@ extension ListView { let container = anyView as! SupplementaryContainerView - guard let headerFooter = self.displayedSupplementaryItems.removeValue(forKey: ObjectIdentifier(view)) else { + guard let headerFooter = self.displayedSupplementaryItems.removeValue(forKey: ObjectIdentifier(container)) else { return } From 4559c41070edcef7eb4f4da9da6a474cba8a76a6 Mon Sep 17 00:00:00 2001 From: Kyle Van Essen Date: Sun, 3 Mar 2024 14:36:30 -0800 Subject: [PATCH 3/3] Prepare 14.0.3 --- CHANGELOG.md | 20 +++++++++++++++----- Podfile.lock | 12 ++++++------ version.rb | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9576e92f..e6e54e34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,6 @@ ### Fixed -- Fixed an issue that could cause a crash during view reuse when the list contained different types of headers. - ### Added ### Removed @@ -14,10 +12,18 @@ ### Internal -- Generated documentation now uses a static copyright notice to avoid noisy diffs. - # Past Releases +# [14.0.3] – 2024-03-03 + +### Fixed + +- Fixed an issue that could cause a crash during view reuse when the list contained different types of headers. + +### Internal + +- Generated documentation now uses a static copyright notice to avoid noisy diffs. + # [14.0.2] - 2024-02-29 ### Fixed @@ -1022,7 +1028,11 @@ listActions.scrolling.scrollToSection( Earlier releases were ad-hoc and not tracked. To see all changes, please reference [closed PRs on Github](https://github.com/kyleve/Listable/pulls?q=is%3Apr+is%3Aclosed). -[Main]: https://github.com/square/Listable/compare/13.1.0...main +[Main]: https://github.com/square/Listable/compare/14.0.3...main +[14.0.3]: https://github.com/square/Listable/square/14.0.2...14.0.3 +[14.0.2]: https://github.com/square/Listable/square/14.0.1...14.0.2 +[14.0.1]: https://github.com/square/Listable/square/14.0.0...14.0.1 +[14.0.0]: https://github.com/square/Listable/square/13.1.0...14.0.0 [13.1.0]: https://github.com/square/Listable/square/13.0.0...13.1.0 [13.0.0]: https://github.com/square/Listable/square/12.0.0...13.0.0 [12.0.0]: https://github.com/square/Listable/compare/11.0.0...12.0.0 diff --git a/Podfile.lock b/Podfile.lock index a779a2a8..fd3de462 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -2,16 +2,16 @@ PODS: - BlueprintUI (3.0.0) - BlueprintUICommonControls (3.0.0): - BlueprintUI (= 3.0.0) - - BlueprintUILists (14.0.2): + - BlueprintUILists (14.0.3): - BlueprintUI (~> 3.0) - ListableUI - - BlueprintUILists/Tests (14.0.2): + - BlueprintUILists/Tests (14.0.3): - BlueprintUI (~> 3.0) - BlueprintUICommonControls (~> 3.0) - ListableUI - EnglishDictionary (1.0.0.LOCAL) - - ListableUI (14.0.2) - - ListableUI/Tests (14.0.2): + - ListableUI (14.0.3) + - ListableUI/Tests (14.0.3): - EnglishDictionary - Snapshot - Snapshot (1.0.0.LOCAL) @@ -46,9 +46,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: BlueprintUI: 76e054862aceb2b014a7953464c5769af55c13d5 BlueprintUICommonControls: 9219a0b82ea4b95bbeef44d3fbc65b9b01f1acba - BlueprintUILists: 0b20c48457844ad52f0adbae0e10e6dd9b9372e1 + BlueprintUILists: e05090537bc310cc26e20a7ea43fb15acfd459b6 EnglishDictionary: 2cf40d33cc1b68c4152a1cc69561aaf6e4ba0209 - ListableUI: 584fff68842032cc5026fccc96b19cadf41f9fa3 + ListableUI: 03c3c57555be736d76c7d9d75c37dfd8d1b9929c Snapshot: 574e65b08c02491a541efbd2619c92cc26514d1c PODFILE CHECKSUM: 2b979d4f2436d28af7c87b125b646836119b89b7 diff --git a/version.rb b/version.rb index 512281c9..161b4ef7 100644 --- a/version.rb +++ b/version.rb @@ -2,7 +2,7 @@ BLUEPRINT_VERSION ||= ['~> 3.0'].freeze -LISTABLE_VERSION ||= '14.0.2' +LISTABLE_VERSION ||= '14.0.3' LISTABLE_IOS_DEPLOYMENT_TARGET ||= '15.0'