hide separator flag

This commit is contained in:
Pfeil, Scott Robert 2019-09-03 15:52:23 -04:00
parent aeaf7ecc5e
commit 32b2ab825b
3 changed files with 12 additions and 0 deletions

View File

@ -41,4 +41,7 @@ typedef enum : NSUInteger {
- (void)setAsLight;
- (void)setAsMedium;
/// Returns if the separator should be visible based on the type.
- (BOOL)shouldBeVisible;
@end

View File

@ -162,6 +162,10 @@
[self setNeedsLayout];
[self layoutIfNeeded];
}
- (BOOL)shouldBeVisible {
return ![[self.json string:KeyType] isEqualToString:@"none"];
}
#pragma mark - Molecule

View File

@ -31,10 +31,15 @@ import UIKit
guard let molecules = json?.optionalArrayForKey(KeyMolecules) as? [[AnyHashable: Any]] else {
return
}
if accordionButton.isSelected {
delegateObject?.moleculeDelegate?.addMolecules?(molecules, senderIndexPath: indexPath)
} else {
delegateObject?.moleculeDelegate?.removeMolecules?(molecules, senderIndexPath: indexPath)
}
if (json?.boolForKey("hideSeparatorWhenExpanded") ?? false) && (self.bottomSeparatorView?.shouldBeVisible() ?? false) {
bottomSeparatorView?.isHidden = accordionButton.isSelected
}
}
}