Skip to content

Commit 3565ce0

Browse files
author
Kyle Van Essen
committed
Add appearance hooks in demo
1 parent 8eefb3b commit 3565ce0

1 file changed

Lines changed: 27 additions & 4 deletions

File tree

Demo/Sources/Demos/Demo Screens/CollectionViewBasicDemoViewController.swift

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,38 @@ final class CollectionViewBasicDemoViewController : UIViewController
7272

7373
section.layouts.table.columns = .init(count: 2, spacing: 10.0)
7474

75-
if self.showsSectionHeaders {
76-
section.header = DemoHeader(title: "Section Header")
75+
section.header = if self.showsSectionHeaders {
76+
HeaderFooter(DemoHeader(title: "Section Header")) {
77+
$0.onDisplay = { _ in
78+
print("Displayed header")
79+
}
80+
$0.onEndDisplay = { _ in
81+
print("Ended displaying header")
82+
}
83+
}
7784
} else {
78-
section.header = DemoHeader2(title: "Section Header")
85+
HeaderFooter(DemoHeader2(title: "Section Header")) {
86+
$0.onDisplay = { _ in
87+
print("Displayed header")
88+
}
89+
$0.onEndDisplay = { _ in
90+
print("Ended displaying header")
91+
}
92+
}
7993
}
8094

8195
section.footer = DemoFooter(text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi non luctus sem, eu consectetur ipsum. Curabitur malesuada cursus ante.")
8296

83-
section += sectionRows
97+
section += sectionRows.map { row in
98+
Item(row) {
99+
$0.onDisplay = { _ in
100+
print("Displayed row")
101+
}
102+
$0.onEndDisplay = { _ in
103+
print("Ended displaying row")
104+
}
105+
}
106+
}
84107
}
85108
}
86109
}

0 commit comments

Comments
 (0)