EndouMari / TabPageViewController

Paging view controller and scroll tab view
MIT License
1.39k stars 221 forks source link

master repo for Swift 4 #82

Closed cafedeichi closed 6 years ago

cafedeichi commented 6 years ago

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

ciamine commented 6 years ago

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)
cafedeichi commented 6 years ago

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

https://github.com/cafedeichi/TabPageViewController

Thx.