I have created a pageViewController with four view controller.
Right now the order is:
VC1, VC2, VC3, VC4:
var pageControl = UIPageControl()
var pendingPage: Int?
lazy var viewControllerList: [UIViewController] = {
let sb = UIStoryboard(name: "Main", bundle: nil)
let vc1 = sb.instantiateViewController(withIdentifier: "VC1")
let vc2 = sb.instantiateViewController(withIdentifier: "VC2")
let vc3 = sb.instantiateViewController(withIdentifier: "VC3")
let vc4 = sb.instantiateViewController(withIdentifier: "VC4")
return [vc1, vc2, vc3, vc4]
}()
How can I set VC2 as the initial view controller of the page view controller when the app loads? So basically the user can swipe left "and" right to got to from VC2 left to VC1 or right from VC2 to VC3.
VC1 < VC2 - this is the start view controller > VC3 > VC4
This is my viewDidLoad():
override func viewDidLoad() {
super.viewDidLoad()
self.delegate = self
self.dataSource = self
if let firstViewController = viewControllerList.first {
self.setViewControllers([firstViewController], direction: .forward, animated: true, completion: nil)
}
}
self.setViewControllers([viewControllerList[1]], direction: .forward, animated: true, completion: nil)