Hide tab bar in IOS swift app
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
Hiding the tab bar in an iOS app is straightforward for simple push flows, but bugs appear quickly in real navigation stacks. Common issues include clipped bottom content, flicker during interactive gestures, and tab bar state desynchronization across controllers. A reliable implementation depends on whether tab visibility is static per screen or dynamic based on user interaction.
Use the Native Static Approach First
If a destination screen should always hide the tab bar, use hidesBottomBarWhenPushed. This is the most stable option because UIKit handles restore behavior automatically.
For many apps, this is all you need. It is easier to maintain than frame animations.
Dynamic Hide and Show With Animation
If the tab bar must appear or disappear based on scrolling or mode changes, create one shared method to control visibility. Keep this in one place so multiple controllers do not conflict.
This method updates both frame and safe-area insets. Without inset updates, bottom controls can become inaccessible.
Lifecycle Placement Matters
For dynamic behavior tied to screen entry and exit, use lifecycle methods carefully.
Keep ownership single. If parent and child controllers both toggle tab visibility, race conditions can cause flicker.
In complex flows, a coordinator object can centralize this policy and expose one method such as setTabVisibility(for screenType).
Scroll-Driven Behavior Pattern
A common requirement is hide on downward scroll and show on upward scroll. Tie state changes to threshold-based scroll deltas to avoid rapid toggling.
Thresholds prevent jitter on minor scroll changes.
SwiftUI Interop Note
In mixed UIKit and SwiftUI apps, tab bar control can become inconsistent if both layers issue visibility changes. Choose one owner, usually UIKit coordinator or root container, and route all tab-visibility requests through that owner. This keeps transitions coherent during gesture navigation and deep links.
Testing Checklist
Before release, test tab bar behavior across:
- push and pop navigation
- interactive swipe-back cancellation
- keyboard show and hide
- rotation changes
- deep links directly to hidden-tab screens
Add at least one UI test for hide on push and show on pop. This catches regressions when navigation code is refactored.
Common Pitfalls
A common pitfall is toggling tabBar.isHidden directly without adjusting safe-area insets, which causes clipped bottom controls. Another is applying dynamic logic where static hidesBottomBarWhenPushed would be simpler. Teams also let multiple controllers manipulate tab state independently, creating non-deterministic flicker. Gesture cancellations are frequently untested and expose half-applied states. Finally, keyboard interactions often reveal layout bugs that were not visible during basic navigation tests. Visual correctness and layout correctness need to be treated as the same problem here.
Summary
- Prefer
hidesBottomBarWhenPushedfor static per-screen tab hiding. - For dynamic behavior, animate frame and safe-area updates together.
- Keep one owner for tab visibility state to avoid conflicts.
- Use thresholds for scroll-driven hide and show logic.
- Test interactive gestures, keyboard, rotation, and deep-link flows.
- Add UI tests for core visibility transitions to prevent regressions.

