Reputation: 8279
I am working on an application that uses a UIPageViewController
to present two main view controllers. I am subclassing the UIPageViewController
and conforming to the UIPageViewControllerDatasource
protocol. The methods in this protocol allow me to set the view controllers I want to display. But the following methods are giving me trouble.
func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? {}
and
func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {}
The issue is the compiler keeps trying to get the parameters in the method to change. It will suggest I made a mistake and either viewControllerAfter
or viewControllerBefore
should be changed. And I keep getting stuck in this loop with this error, "method 'pageViewController(_:viewControllerBefore:)' has different argument names from protocol 'UIPageViewControllerDatasource'
."
BEFORE
Then I make the change as suggested, and it persists.
AFTER
I need some pointers on how to get around this.
Upvotes: 4
Views: 306
Reputation: 11484
From my understanding, you need to implement both methods. This should get rid of your errors.
Upvotes: 4