iosswiftxlpagertabstrip

Sub-class must implement the PagerTabStripDataSource viewControllers(for:) method in XLPagerTabStripe library


I've updated Swift project from Swift 2 to Swift 4 and I'm facing this issue. Before migration it worked fine in Swift 2. But after migration error occurred

Sub-class must implement the PagerTabStripDataSource viewControllers(for:) method

As I found solution on google, Some people suggest to add this delegate.

func indicatorInfo(for pagerTabStripController: PagerTabStripViewController) -> IndicatorInfo {
    return IndicatorInfo(title: "BASIC INFO")
}

I added this function but this doesn't help. Can anyone please help me? Thanks.


Solution

  • I missed this function.

    override func viewControllers(for pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
    ...
    }
    

    When I add this function, it worked fine. It was like this before.

    func viewControllersForPagerTabStrip(_ pagerTabStripController: PagerTabStripViewController) -> [UIViewController] {
    }