diff --git a/Tusker/Screens/Profile/ProfileHeaderCollectionViewCell.swift b/Tusker/Screens/Profile/ProfileHeaderCollectionViewCell.swift index 32c08bf1..e2ba1e71 100644 --- a/Tusker/Screens/Profile/ProfileHeaderCollectionViewCell.swift +++ b/Tusker/Screens/Profile/ProfileHeaderCollectionViewCell.swift @@ -12,6 +12,14 @@ class ProfileHeaderCollectionViewCell: UICollectionViewCell { private var state: State = .unloaded + var view: ProfileHeaderView? { + if case .view(let view) = state { + return view + } else { + return nil + } + } + override init(frame: CGRect) { super.init(frame: frame) diff --git a/Tusker/Screens/Profile/ProfileViewController.swift b/Tusker/Screens/Profile/ProfileViewController.swift index 94007404..47d3d794 100644 --- a/Tusker/Screens/Profile/ProfileViewController.swift +++ b/Tusker/Screens/Profile/ProfileViewController.swift @@ -297,11 +297,13 @@ extension ProfileViewController: ProfileHeaderViewDelegate { extension ProfileViewController: TabbedPageViewController { func selectNextPage() { guard currentIndex < pageControllers.count - 1 else { return } + currentViewController.headerCell?.view?.pagesSegmentedControl.selectedSegmentIndex = currentIndex + 1 selectPage(at: currentIndex + 1, animated: true) } func selectPrevPage() { guard currentIndex > 0 else { return } + currentViewController.headerCell?.view?.pagesSegmentedControl.selectedSegmentIndex = currentIndex - 1 selectPage(at: currentIndex - 1, animated: true) } }