Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

Commit

Permalink
Improving ExpyTableViewHeaderCell calls in cellForRowAtIndexPath.
Browse files Browse the repository at this point in the history
  • Loading branch information
okhanokbay committed Jun 22, 2017
1 parent ece9397 commit be75c04
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
18 changes: 18 additions & 0 deletions Example/ExpyTableView/CustomizationExampleViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@ import ExpyTableView
class CustomizationExampleViewController: UIViewController {

let sampleData = [["iPhone SE (3 Items)", "64 GB Memory", "4 inches", "Apple A9, 64 bit"],
["iPhone 6 (3 Items)", "128 GB Memory", "4.7 inches", "Apple A8, 64 bit"],
["iPhone 7 Plus (4 Items)", "256 GB Memory", "5.5 inches", "Apple A10 Fusion(64 bit)", "Force Touch: Yes"],
["iPhone SE (3 Items)", "64 GB Memory", "4 inches", "Apple A9, 64 bit"],
["iPhone 6 (3 Items)", "128 GB Memory", "4.7 inches", "Apple A8, 64 bit"],
["iPhone 7 Plus (4 Items)", "256 GB Memory", "5.5 inches", "Apple A10 Fusion(64 bit)", "Force Touch: Yes"],
["iPhone SE (3 Items)", "64 GB Memory", "4 inches", "Apple A9, 64 bit"],
["iPhone 6 (3 Items)", "128 GB Memory", "4.7 inches", "Apple A8, 64 bit"],
["iPhone 7 Plus (4 Items)", "256 GB Memory", "5.5 inches", "Apple A10 Fusion(64 bit)", "Force Touch: Yes"],
["iPhone SE (3 Items)", "64 GB Memory", "4 inches", "Apple A9, 64 bit"],
["iPhone 6 (3 Items)", "128 GB Memory", "4.7 inches", "Apple A8, 64 bit"],
["iPhone 7 Plus (4 Items)", "256 GB Memory", "5.5 inches", "Apple A10 Fusion(64 bit)", "Force Touch: Yes"],
["iPhone SE (3 Items)", "64 GB Memory", "4 inches", "Apple A9, 64 bit"],
["iPhone 6 (3 Items)", "128 GB Memory", "4.7 inches", "Apple A8, 64 bit"],
["iPhone 7 Plus (4 Items)", "256 GB Memory", "5.5 inches", "Apple A10 Fusion(64 bit)", "Force Touch: Yes"],
["iPhone SE (3 Items)", "64 GB Memory", "4 inches", "Apple A9, 64 bit"],
["iPhone 6 (3 Items)", "128 GB Memory", "4.7 inches", "Apple A8, 64 bit"],
["iPhone 7 Plus (4 Items)", "256 GB Memory", "5.5 inches", "Apple A10 Fusion(64 bit)", "Force Touch: Yes"],
["iPhone SE (3 Items)", "64 GB Memory", "4 inches", "Apple A9, 64 bit"],
["iPhone 6 (3 Items)", "128 GB Memory", "4.7 inches", "Apple A8, 64 bit"],
["iPhone 7 Plus (4 Items)", "256 GB Memory", "5.5 inches", "Apple A10 Fusion(64 bit)", "Force Touch: Yes"],
["iPhone SE (3 Items)", "64 GB Memory", "4 inches", "Apple A9, 64 bit"],
Expand Down
14 changes: 8 additions & 6 deletions ExpyTableView/Classes/ExpyTableView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,14 @@ extension ExpyTableView: UITableViewDataSource {
return headerCell
}

if visibleSections[indexPath.section] == true {
headerCellConformant.changeState(.willExpand, cellReuseStatus: true)
headerCellConformant.changeState(.didExpand, cellReuseStatus: true)
}else {
headerCellConformant.changeState(.willCollapse, cellReuseStatus: true)
headerCellConformant.changeState(.didCollapse, cellReuseStatus: true)
DispatchQueue.main.async { [weak self] _ in
if self?.visibleSections[indexPath.section] == true {
headerCellConformant.changeState(.willExpand, cellReuseStatus: true)
headerCellConformant.changeState(.didExpand, cellReuseStatus: true)
}else {
headerCellConformant.changeState(.willCollapse, cellReuseStatus: true)
headerCellConformant.changeState(.didCollapse, cellReuseStatus: true)
}
}
return headerCell
}
Expand Down

0 comments on commit be75c04

Please sign in to comment.