Getting this PageViewController error does not conform to the 'UIPageViewControllerDataSource' protocol

I cannot fix this error or find out the cause of this error, and the error is shown below in the screenshot.

Just trying to create a pageViewController demo, and I can not add the dataSource class, but self.dataSource = self.

Thanks in advance.

enter image description here

+4
source share
1 answer

Just adding a protocol definition for your custom class is not enough. You must provide at least two required protocol functions UIPageViewControllerDataSource:

func pageViewController(pageViewController: UIPageViewController, viewControllerBeforeViewController viewController: UIViewController) -> UIViewController?

func pageViewController(pageViewController: UIPageViewController, viewControllerAfterViewController viewController: UIViewController) -> UIViewController?
+5
source

All Articles