Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/AloeStackView/AloeStackView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ open class AloeStackView: UIScrollView {
///
/// If `animated` is `true`, the change is animated.
open func setRowHidden(_ row: UIView, isHidden: Bool, animated: Bool = false) {
guard let cell = row.superview as? StackViewCell else { return }
guard let cell = row.superview as? StackViewCell, cell.isHidden != isHidden else { return }

if animated {
UIView.animate(withDuration: 0.3) {
Expand Down
12 changes: 12 additions & 0 deletions Tests/AloeStackViewTests/AloeStackViewTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,16 @@ final class AloeStackViewTests: XCTestCase {
func test() {
}

func testSetRowHiddenDuplicateCalls() {
let stackView = AloeStackView()
let row = UIView()
stackView.addRow(row)

stackView.setRowHidden(row, isHidden: true, animated: true)
stackView.setRowHidden(row, isHidden: true, animated: true)
stackView.setRowHidden(row, isHidden: false, animated: true)

XCTAssertFalse(stackView.isRowHidden(row))
}

}