How to set UINavigationBar barStyle in iOS 15 beta 8

Before iOS 15:

let navigationBar = UINavigationBar()
navigationBar.barStyle = .black

After iOS 15:

let appearance = UINavigationBarAppearance()
appearance.barStyle???

Any help?

Answered by Claude31 in 687737022

Did you try:

          let appearance = UINavigationBarAppearance()           appearance.barStyle = .blackTranslucent

// or other options:

If not enough, you may find more here :

https://developer.apple.com/forums/thread/683590

After iOS 15, barStyle not working.

Accepted Answer

Did you try:

          let appearance = UINavigationBarAppearance()           appearance.barStyle = .blackTranslucent

// or other options:

If not enough, you may find more here :

https://developer.apple.com/forums/thread/683590

Note as well that you can now set appearance in IB directly:

Xcode 13 RC Release notes:

UINavigationBar, UITabBar, and UIToolbar inspectors now support configuring a UIBarAppearance instance. (74054594)

Add some details: If you only set barStyle to UINavigationBar, it's no problem. But set with UINavigationBarAppearance, barStyle becames invalid. So I just wanna understand how to modify barStyle with UINavigationBarAppearance in iOS 15 RC.

How to set UINavigationBar barStyle in iOS 15 beta 8
 
 
Q