Post

Replies

Boosts

Views

Activity

Reply to Status bar color in iOS 16
Final solution (by @ashley-mills and refined by me): You can also check at StackOverflow First, a View extension to keep it clean: func iOS16navBarAdapter(_ colorScheme: ColorScheme) -> some View { if #available(iOS 16, *) { return self .toolbarBackground(Color.navigationBar, for: .navigationBar) .toolbarBackground(.visible, for: .navigationBar) .toolbarColorScheme(colorScheme, for: .navigationBar) } else { return self } } You can use as follows on your view: @State private var iOS16colorScheme: ColorScheme = .dark ... VStack { ... } .iOS16navBarAdapter(iOS16colorScheme) .onChange(of: globalSideMenu.xCoord) { value in iOS16colorScheme = value > sideMenuOffset ? .light : .dark }
Jan ’23