Reputation: 157
I am looking to set up a VC that handles my UIPageViewControllerDataSource but for whatever reason I am getting this error. Is there another protocol I need to include. My code:
class ViewController: UIViewController, UIPageViewControllerDelegate, UIPageViewControllerDataSource
Thanks!
Upvotes: 0
Views: 726
Reputation: 9409
Adding the protocol definition for your custom class is not enough. You have to provide at least the two required functions of the UIPageViewControllerDataSource
protocol:
func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController?
func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController?
Take a close look at the methods you can implement within your class in the UIPageViewControllerDataSource Protocol Reference documentation.
Upvotes: 1
Reputation: 1695
You have to implement the following methods:
pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController?
pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController?
Upvotes: 0