'thin line on top of tab bar not removed in iOS 15

Tried using below code in iOS 15, but the thin line on top of tabbar is not removed but below code works in iOS 13, iOS 14

let appearance = UITabBarAppearance()

appearance.shadowImage = nil

appearance.shadowColor = nil

appearance.backgroundEffect = nil

appearance.backgroundColor = UIColor.white

tabBar.standardAppearance = appearance


Solution 1:[1]

You can try this

tabBar.standardAppearance.shadowColor = nil
tabBar.scrollEdgeAppearance.shadowColor = nil

Example in viewDidLoad :

override func viewDidLoad() {
    super.viewDidLoad()
    //...
    
    self.navigationController?.navigationBar.standardAppearance.shadowColor = nil
    self.navigationController?.navigationBar.scrollEdgeAppearance?.shadowColor = nil
}

Solution 2:[2]

You need to apply this on tab bar class

  override func viewDidAppear(_ animated: Bool) {
    
    if #available(iOS 15.0, *) {

        let appearance = UITabBarAppearance()
        appearance.configureWithOpaqueBackground()
        appearance.backgroundColor = .white
        tabBar.standardAppearance = appearance
        tabBar.scrollEdgeAppearance = tabBar.standardAppearance

    }
    
}

Solution 3:[3]

It seems that on iOS 15 this is working to remove the shadow line

tabBar.standardAppearance.configureWithTransparentBackground()
tabBar.clipsToBounds = true

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
Solution 2 alex
Solution 3 TomCobo