Skip to content

Commit

Permalink
CNBCMAPP-15567 Cache Crash Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
EthanJMoon1020 committed May 27, 2022
1 parent 903b760 commit e617d23
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Sources/ButtonBarPagerTabStripViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,27 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa
buttonBarView.selectItem(at: IndexPath(item: currentIndex, section: 0), animated: false, scrollPosition: [])
}

private var shouldUpdateContent = true

// MARK: - Public Methods

open override func reloadPagerTabStripView() {
shouldUpdateContent = false
super.reloadPagerTabStripView()
shouldUpdateContent = true
guard isViewLoaded else { return }
buttonBarView.reloadData()
cachedCellWidths = calculateWidths()
buttonBarView.layoutIfNeeded()
updateContent()
buttonBarView.moveTo(index: currentIndex, animated: false, swipeDirection: .none, pagerScroll: .yes)
}

open override func updateContent() {
if shouldUpdateContent {
super.updateContent()
}
}

open func calculateStretchedCellWidths(_ minimumCellWidths: [CGFloat], suggestedStretchedCellWidth: CGFloat, previousNumberOfLargeCells: Int) -> CGFloat {
var numberOfLargeCells = 0
Expand Down

0 comments on commit e617d23

Please sign in to comment.