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

431 Views Asked by At

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.

2

There are 2 best solutions below

0
Ioan Moldovan On BEST ANSWER

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] {
}
0
Renzo Tissoni On

Check this link to the GitHub page for XLPagerTapStrip. Many names changed from swift 2 to swift 3 and the function that the error says you need is in there, so you'll need to reimplement o rename some functions for it to work.