diff --git a/Sources/ButtonBarPagerTabStripViewController.swift b/Sources/ButtonBarPagerTabStripViewController.swift index 016fa24..86addf1 100644 --- a/Sources/ButtonBarPagerTabStripViewController.swift +++ b/Sources/ButtonBarPagerTabStripViewController.swift @@ -259,11 +259,11 @@ open class ButtonBarPagerTabStripViewController: PagerTabStripViewController, Pa if reload { let indexPathsToReload = cells.enumerated() - .flatMap { (arg) -> IndexPath? in + .compactMap { (arg) -> IndexPath? in let (index, cell) = arg return cell == nil ? indexPaths[index] : nil } - .flatMap { (indexPath: IndexPath) -> IndexPath? in + .compactMap { (indexPath: IndexPath) -> IndexPath? in return (indexPath.item >= 0 && indexPath.item < buttonBarView.numberOfItems(inSection: indexPath.section)) ? indexPath : nil }