问题
I wrote in Swift 1.2 the next:
self.pageViewController.setViewControllers(viewControllers as [AnyObject], direction: .Forward, animated: true, completion: nil)
but now, in Swift 2 it prints me the next error:
Could not find member 'Forward'
How can I fix it?
回答1:
You should make sure that your viewControllers not optional Type. Such as:
var viewControllers:[UIViewController] = [VC1,VC2]
self.pageViewController.setViewControllers(viewControllers, direction: UIPageViewControllerNavigationDirection.Forward, animated: true, completion: nil)
来源:https://stackoverflow.com/questions/32564132/swift-2-syntax-error-with-direction-forward