0

I have been trying to use pageContainer.setViewControllers([displayThisViewController], direction: .forward, animated: true, completion: nil)to turn from viewControllerA to viewControllerB. This is my implementation of it in viewControllerA:

pageViewController().setViewControllers([viewControllerB()], direction: .forward, animated: true, completion: nil)

The problem that I have run into is that whenever I try to run this line of code I receive the error

fatal error: unexpectedly found nil while unwrapping an Optional value

What am I doing wrong? Is it something in my pageViewController class? Thanks in advance.

edit: both view controllers were created in the storyboard, and embedded into the UIPageViewController

edit: I understand what the error message means but I do not understand what is causing it or how to fix it.

joshLor
  • 1,034
  • 1
  • 12
  • 27
  • What is viewControllerB( ) ? Is that the name of a class that you are constructing? Is it defined in a storyboard, because if so, this method of construction will not wire up any outlets. – Mike Taverne Apr 27 '17 at 00:50
  • @MikeTaverne It is a view controller created that was created in the storyboard and embedded into the UIPage controller – joshLor Apr 27 '17 at 01:12

0 Answers0