Skip to content

Instantly share code, notes, and snippets.

View pffan91's full-sized avatar
🌍
Developing the Future

Vladyslav Semenchenko pffan91

🌍
Developing the Future
View GitHub Profile
@pffan91
pffan91 / SlideAnimationTabBarController.swift
Created April 11, 2022 14:03 — forked from illescasDaniel/SlideAnimationTabBarController.swift
[Updated to Swift 4] - UITabBarController slide animation. Slide left and right when tabs are selected. Based on code from StackOverflow
func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
if let fromView = tabBarController.selectedViewController?.view,
let toView = viewController.view, fromView != toView,
let controllerIndex = self.viewControllers?.firstIndex(of: viewController) {
let viewSize = fromView.frame
let scrollRight = controllerIndex > tabBarController.selectedIndex
if fromView.superview?.subviews.contains(toView) == true { return false }