Skip to content

Commit 4863c93

Browse files
committed
Scroll to the current session instead of just scrolling to the top
2 parents 89f026b + a66a66e commit 4863c93

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

trySwift/RootTabBar/RootTabBarController.swift

+7-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,13 @@ class RootTabBarController: UITabBarController, UITabBarControllerDelegate {
3333
scrollableToTop.scrollAfterTabTap()
3434
// or we find the topmost scroll view and scroll it to the top
3535
} else {
36-
firstController.view.findScrollSubview()?.setContentOffset(.zero, animated: true)
36+
if let firstController = navigationController.viewControllers.first {
37+
if let scrollableToTop = firstController as? ScrollableToTop {
38+
scrollableToTop.scrollAfterTabTap()
39+
} else {
40+
firstController.view.findScrollSubview()?.setContentOffset(.zero, animated: true)
41+
}
42+
}
3743
}
3844
}
3945
}

0 commit comments

Comments
 (0)