EndouMari/TabPageViewController

master repo for Swift 4

cafedeichi opened this issue · 2 comments

Hoping you update the master repo for Swift 4.
(Seemingly you already have the branch and it works fine, though, why not yet?)

hi
change tabItemButtonPressedBlock?() to tabItemButtonPressedBlock?(())
and add to cell.tabItemButtonPressedBlock , as (() -> Void)

cell.tabItemButtonPressedBlock = { [weak self, weak cell] in
            var direction: UIPageViewControllerNavigationDirection = .forward
            if let pageTabItemsCount = self?.pageTabItemsCount, let currentIndex = self?.currentIndex {
                if self?.isInfinity == true {
                    if (indexPath.item < pageTabItemsCount) || (indexPath.item < currentIndex) {
                        direction = .reverse
                    }
                } else {
                    if indexPath.item < currentIndex {
                        direction = .reverse
                    }
                }
            }
            self?.pageItemPressedBlock?(fixedIndex, direction)

            if cell?.isCurrent == false {
                // Not accept touch events to scroll the animation is finished
                self?.updateCollectionViewUserInteractionEnabled(false)
            }
            self?.updateCurrentIndexForTap(indexPath.item)
            } as (() -> Void)

Hi Mari,
I forked your repo and updated it for Swift4.2/Xcode10.

https://github.com/cafedeichi/TabPageViewController

Thx.