'Swift tabBar not displaying correctly

In Xcode I have this app that uses tabBarItem. There are 5 items and occasionally when I'm on a specific page I get this weird overlay of the tabBarItems (see pictures). I say occasionally, because it does not do it always but it is still very frequent. Not sure if it is just a limitation with tabBarItem or if I have a bug.

This is how it SHOULD look: enter image description here

This is how it SHOULD NOT look, but does: enter image description here

As you can see in the second image the tabBar is being overlayed onto the other text rather than disappearing behind it. It's odd that it behaves differently for each tab.

I can fix the issue with

        if #available(iOS 15.0, *) {
            let appearance = UITabBarAppearance()
            appearance.configureWithOpaqueBackground()
            appearance.backgroundColor = .black
            UITabBar.appearance().standardAppearance = appearance
            UITabBar.appearance().scrollEdgeAppearance = UITabBar.appearance().standardAppearance
        }

But need a fix that would work for IOS 11+



Solution 1:[1]

        UITabBar.appearance().isTranslucent = false
        UITabBar.appearance().backgroundColor = .black

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 texasRanger