Skip to content

Commit 07f0b93

Browse files
committed
Enforced initialOpenSections and sectionsAlwaysOpen to be set at the start.
1 parent f4adb60 commit 07f0b93

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

FZAccordionTableView/FZAccordionTableView.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,17 @@
6969
/*!
7070
@desc Defines which sections should be open the first time the
7171
table is shown.
72+
73+
Must be set before any data is loaded.
7274
*/
7375
@property (strong, nonatomic, nullable) NSSet <NSNumber *> *initialOpenSections;
7476

7577
/*!
7678
@desc Defines which sections will always be open.
7779
The headers of these sections will not call the
7880
FZAccordionTableViewDelegate methods.
81+
82+
Must be set before any data is loaded.
7983
*/
8084
@property (strong, nonatomic, nullable) NSSet <NSNumber *> *sectionsAlwaysOpen;
8185

FZAccordionTableView/FZAccordionTableView.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,16 @@ - (BOOL)respondsToSelector:(SEL)aSelector {
256256
#pragma mark - Override Setters -
257257

258258
- (void)setInitialOpenSections:(NSSet *)initialOpenedSections {
259+
NSAssert(self.sectionInfos.count == 0, @"'initialOpenedSections' MUST be set before the tableView has started loading data.");
259260
_initialOpenSections = initialOpenedSections;
260261
_mutableInitialOpenSections = [initialOpenedSections mutableCopy];
261262
}
262263

264+
- (void)setSectionsAlwaysOpen:(NSSet<NSNumber *> *)sectionsAlwaysOpen {
265+
NSAssert(self.sectionInfos.count == 0, @"'sectionsAlwaysOpen' MUST be set before the tableView has started loading data.");
266+
_sectionsAlwaysOpen = sectionsAlwaysOpen;
267+
}
268+
263269
#pragma mark - FZAccordionTableViewHeaderViewDelegate -
264270

265271
- (void)tappedHeaderView:(FZAccordionTableViewHeaderView *)sectionHeaderView {

0 commit comments

Comments
 (0)