         default:()
         }
     }
+    
+    func pageIndex(_ index: PageIndex, isNextTo other: PageIndex) -> Bool {
+        return index - other == 1 || other - index == 1
+    }
 }

                }
                
                // Reload current view controller in UIPageViewController if insertion index is next/previous page.
                if (currentIndex - index) == 1 || (index - currentIndex) == 1 {
                    guard let currentViewController = self.currentViewController else {
                        return
                    }

                   "Attempt to delete page at \(index) but there are \(newPageCount) pages after the update")
            
            let sanitizedIndex = min(index, newPageCount)
            guard let currentIndex = self.currentIndex else {
                return
            }
            guard let newViewController = dataSource?.viewController(for: self, at: sanitizedIndex) else {
                return
            }
