Swift 2语法错误与方向.Forward

我在下一篇文章中写道:

self.pageViewController.setViewControllers(viewControllers as [AnyObject], direction: .Forward, animated: true, completion: nil) 

但是现在,在Swift 2中它打印出下一个错误:

 Could not find member 'Forward' 

我该如何解决?

您应该确保您的viewControllers不是可选的Type。 如:

 var viewControllers:[UIViewController] = [VC1,VC2] self.pageViewController.setViewControllers(viewControllers, direction: UIPageViewControllerNavigationDirection.Forward, animated: true, completion: nil)