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

Viewed 529

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
3 Answers

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
}

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

    }
    
}

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

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