Deprecation notice: As of iOS 18,
UITabBarControllernatively supports hiding/showing its tab bar with animation viasetTabBarHidden(_:animated:)andisTabBarHidden. This library is soft-deprecated and will eventually be archived — please migrate to the system API once your minimum deployment target reaches iOS 18. All symbols in this library have been prefixed withhd_(e.g.hd_setTabBarHidden(_:animated:)) to avoid colliding with Apple's native members of the same name.
- iOS 15.0
- Swift 5.5
See the subsections below for details about the different installation methods.
- Prepare project for CocoaPods usage by CocoaPods - Install / Get Started
- Add pod to project's profile
pod 'HideableUITabBar'- LETS ROCK! or install pod
cd {PATH_TO_PROJECT}
pod install- Go to project
File→Add Packages...- Search for library, using URL:
https://github.com/dmytriigolovanov/hideable-uitabbar
- Set the
Dependency RuletoUp to Next Major Version Add Package
Import library to needed swift file.
import HideableTabBarCall hd_setTabBarHidden(_:animated:) func to hide / show UITabBar.
let tabBarController = UITabBarController()
// hide tabbar
tabBarController.hd_setTabBarHidden(true, animated: true)
// show tabbar
tabBarController.hd_setTabBarHidden(false, animated: true)Library provides ability to execute additional animation by subclassing UITabBarController and override hd_tabBarHideShowAdditionalAnimations(hidden:) func.
RECOMMENDATION: This functionality can be used to animate additional UI elements, for exmaple such call button.
class TabBarController: UITabBarController {
override func hd_tabBarHideShowAdditionalAnimations(hidden: Bool) {
super.hd_tabBarHideShowAdditionalAnimations(hidden: hidden)
// additional animation
}
}On iOS 18+, prefer the system API instead:
tabBarController.setTabBarHidden(true, animated: true)
The contents of this repository are licensed under the MIT License.