Skip to content

Commit

Permalink
Fix SPOS reordering crash / header reuse issue + prep 14.0.3 (#531)
Browse files Browse the repository at this point in the history
Fix SPOS reordering crash / header reuse issue.
  • Loading branch information
kyleve authored Mar 4, 2024
2 parents 1bc42a2 + 4559c41 commit 12b5e65
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 11 deletions.
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,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
Expand Down Expand Up @@ -1020,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
Expand Down
34 changes: 34 additions & 0 deletions Demo/Sources/Demos/Demo Screens/PaymentTypesViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ListableUI/Sources/ListView/ListView.Delegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
12 changes: 6 additions & 6 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down

0 comments on commit 12b5e65

Please sign in to comment.