title: UIPageViewController initial swipe called twice
body: <p>The below function is how I display different views when a user swipes right where
  self.viewControllerAtIndex() is my own custom function that returns a view. The problem is that the first swipe outputs "---------swipe Right before 0" twice. And then works perfectly like expected afterwards.  </p>
  
  <pre><code>func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -&gt; UIViewController? {
      print("---------swipe Right before " + String(index))
      index += 1
      print("---------swipe Right " + String(index))
  
      if index == (products!.count) {
          index = 0
      }
  
      return self.viewControllerAtIndex(index:index)
  
  }
  =====CONSOLE OUTPUT=====
  ---------swipe Right before 0
  ---------swipe Right 1
  ---------swipe Right before 0
  ---------swipe Right 1
  
   func viewControllerAtIndex(index: Int) -&gt; ViewController{
  
     return ViewController.init(id: index)
   }
  </code></pre>
  
  <p>For some reason, every other swipe after the first works as expected. The initial swipe is what causes the console output above. This causes my view sequence to look like below (2 views)</p>
  
  <pre><code>First Swipe
  View1
  Second Swipe
  View1
  Third Swipe
  View2
  Fourth Swipe
  View1
  Fifth Swipe
  View2
  </code></pre>
  
  <p>I'm also initiating my uiPageViewController like so</p>
  
  <pre><code>let array = [ViewController](repeating: ViewController.init(videos: (self.videos![self.products![self.index].id]!)), count: 1)
  
  self.UIViewPageController?.setViewControllers(array, direction: UIPageViewControllerNavigationDirection.forward, animated: false, completion: nil)
  </code></pre>
  
  <p>So I'm creating a new ViewController on viewDidLoad and then when a user swipes, I'm creating new ViewControllers</p>