SwiftUI-TabView

Hello world !

I have a small problem with my TabView I would like to put a . Shadow, but it doesn't work and does anyone have an idea.

Thanks

Answered by Claude31 in 720905022

I'm not sure you can add a border to the TabView.

Adding a modifier to TabView

            .border(Color.blue, width: 6)

creates a border around the full List

But you can set a shadow: https://stackoverflow.com/questions/72237518/add-top-shadow-to-tabview-in-swiftui

let appearance = UITabBarAppearance()
appearance.shadowColor = .white
appearance.shadowImage = UIImage(named: "tab-shadow")?.withRenderingMode(.alwaysTemplate)
appearance.backgroundColor = UIColor.darkGray

UITabBar.appearance().scrollEdgeAppearance = appearance
Accepted Answer

I'm not sure you can add a border to the TabView.

Adding a modifier to TabView

            .border(Color.blue, width: 6)

creates a border around the full List

But you can set a shadow: https://stackoverflow.com/questions/72237518/add-top-shadow-to-tabview-in-swiftui

let appearance = UITabBarAppearance()
appearance.shadowColor = .white
appearance.shadowImage = UIImage(named: "tab-shadow")?.withRenderingMode(.alwaysTemplate)
appearance.backgroundColor = UIColor.darkGray

UITabBar.appearance().scrollEdgeAppearance = appearance

Okay Thank you very much

SwiftUI-TabView
 
 
Q