title: UIPageviewcontroller swipe page not working
body: <p>I am creating a basic <code>UIPageViewController</code> in my apps after login. However, I would to modify the paging and set the initial viewcontroller as the middle one(page A) <a href="https://i.stack.imgur.com/lDIlq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lDIlq.png" alt="like this"></a> </p>
  
  <p>After login it could only show the initial but the paging is not working. How can i solve this problem? Please leave a comment if you need anymore information.</p>
  
  <pre><code>class MainPageViewController: UIViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate {
  
  
  var pageViewController: UIPageViewController!
  let pages = ["SecondVC","MainVC","ThirdVC"]
  
  
  //MARK: Page view controller datasource
  
  func pageViewController(pageViewController: UIPageViewController,
      viewControllerBeforeViewController viewController: UIViewController) -&gt; UIViewController? {
  
          if let index = pages.indexOf(viewController.restorationIdentifier!){
              if index &gt; 0 {
                  return viewControllerAtIndex(index - 1 )
              }
          }
  
          return nil
  }
  
  func pageViewController(pageViewController: UIPageViewController,
      viewControllerAfterViewController viewController: UIViewController) -&gt; UIViewController? {
  
          if let index = pages.indexOf(viewController.restorationIdentifier!){
  
              if index &lt; pages.count - 1 {
                  return viewControllerAtIndex(index + 1)
              }
          }
          return nil
  }
  
  func viewControllerAtIndex(index: Int) -&gt; UIViewController?{
      let vc = storyboard?.instantiateViewControllerWithIdentifier(pages[index])
      return vc
  }
  
  
  override func viewDidLoad() {
      super.viewDidLoad()
  
      if let vc = storyboard?.instantiateViewControllerWithIdentifier("StructurePageViewController"){
          self.addChildViewController(vc)
          self.view.addSubview(vc.view)
  
          pageViewController = vc as! UIPageViewController
          pageViewController.dataSource = self
          pageViewController.delegate = self
  
          pageViewController.setViewControllers([viewControllerAtIndex(0)!], direction: .Forward, animated: true, completion: nil )
          pageViewController.didMoveToParentViewController(self)
  
      }
  }
  
  override func didReceiveMemoryWarning() {
      super.didReceiveMemoryWarning()
      // Dispose of any resources that can be recreated.
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/6QYcI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6QYcI.png" alt="enter image description here"></a></p>