diff --git a/Tusker/Screens/Utilities/SegmentedPageViewController.swift b/Tusker/Screens/Utilities/SegmentedPageViewController.swift index c3235b47..636c5798 100644 --- a/Tusker/Screens/Utilities/SegmentedPageViewController.swift +++ b/Tusker/Screens/Utilities/SegmentedPageViewController.swift @@ -8,7 +8,7 @@ import UIKit -class SegmentedPageViewController: UIPageViewController, UIPageViewControllerDataSource, UIPageViewControllerDelegate { +class SegmentedPageViewController: UIPageViewController, UIPageViewControllerDelegate { let titles: [String] let pageControllers: [UIViewController] @@ -23,7 +23,6 @@ class SegmentedPageViewController: UIPageViewController, UIPageViewControllerDat super.init(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil) - self.dataSource = self self.delegate = self } @@ -54,20 +53,7 @@ class SegmentedPageViewController: UIPageViewController, UIPageViewControllerDat @objc func segmentedControlChanged() { selectPage(at: segmentedControl.selectedSegmentIndex, animated: true) } - - // MARK: - Page View Controller Data Source - func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? { - guard let index = pageControllers.firstIndex(of: viewController), - index > 0 else { return nil } - return pageControllers[index - 1] - } - - func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? { - guard let index = pageControllers.firstIndex(of: viewController), - index < pageControllers.count - 1 else { return nil } - return pageControllers[index + 1] - } - + // MARK: - Page View Controller Delegate func pageViewController(_ pageViewController: UIPageViewController, didFinishAnimating finished: Bool, previousViewControllers: [UIViewController], transitionCompleted completed: Bool) { currentIndex = pageControllers.firstIndex(of: viewControllers!.first!)!