1

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?

3
  • Did you try UIPageViewControllerNavigationDirection.Forward instead of .Forward? Commented Sep 14, 2015 at 11:56
  • in this case it prints animated: true part the next error 'Bool' is not convertible to 'BooleanLiteralConvertible' Commented Sep 14, 2015 at 11:58
  • 3
    The error is probably in the first argument which should have type [UIViewController]?. Try to just remove the as [AnyObject] (depends on how viewControllers is declared). Commented Sep 14, 2015 at 12:02

1 Answer 1

9

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)
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.