I am looking at the code to implement the pageviewcontroller and I don't understand this line of code:
let currentIndex: Int = subViewController.index(of: viewController) ?? 0
What does ??
mean?
It was used in this context:
func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? {
let currentIndex: Int = subViewController.index(of: viewController) ?? 0
if currentIndex <= 0 {
return nil
}
return subViewController[currentIndex - 1]
}