title: How can I display page controller only on the first launch IOS Swift
body: <p>I want to display the page controller only the first time when users opens the app, and after that when he opens again, then it skips the page controller and directly move to the Home Screen. </p>
  
  <p>Here is the code - </p>
  
  <pre><code>import UIKit
  
  class PageVC: UIPageViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate {
  
  lazy var VCArr: [UIViewController] = {
      return [self.VCInstance(name: "FirstVC"),
              self.VCInstance(name: "SecondVC"),
              self.VCInstance(name: "ThirdVC")]
  }()
  
  private func VCInstance(name: String) -&gt; UIViewController {
      return UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: name)
  }
  
  override func viewDidAppear(_ animated: Bool) {
      super.viewDidAppear(animated)
      self.dataSource = self
      self.delegate = self
      if let firstVC = VCArr.first {
          setViewControllers([firstVC], direction: .forward, animated: true, completion: nil)
      }
  }
  
  override func viewDidLayoutSubviews() {
      super.viewDidLayoutSubviews()
      for view in self.view.subviews {
          if view is UIScrollView {
              view.frame = UIScreen.main.bounds
          } else if view is UIPageControl {
              view.backgroundColor = UIColor.clear
          }
      }
  }
  
  
  public func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -&gt; UIViewController? {
      guard let viewControllerIndex = VCArr.index(of: viewController) else {
          return nil
      }
  
      let previousIndex = viewControllerIndex - 1
  
      guard previousIndex &gt;= 0 else {
          return VCArr.last
      }
  
      guard VCArr.count &gt; previousIndex else {
          return nil
      }
  
      return VCArr[previousIndex]
  }
  
  public func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -&gt; UIViewController? {
      guard let viewControllerIndex = VCArr.index(of: viewController) else {
          return nil
      }
  
      let nextIndex = viewControllerIndex + 1
  
      guard nextIndex &lt; VCArr.count else {
          return VCArr.first
      }
  
      guard VCArr.count &gt; nextIndex else {
          return nil
      }
  
      return VCArr[nextIndex]
  }
  
  public func presentationCount(for pageViewController: UIPageViewController) -&gt; Int {
      return VCArr.count
  }
  
  
  public func presentationIndex(for pageViewController: UIPageViewController) -&gt; Int {
      guard let firstViewController = viewControllers?.first,
          let firstViewControllerIndex = VCArr.index(of: firstViewController) else {
              return 0
      }
  
      return firstViewControllerIndex
  }
  }
  </code></pre>