iOS 15: Restore proper navigation bar appearance

This commit is contained in:
Davide De Rosa 2021-10-17 19:31:13 +02:00
parent 10fd69579b
commit 28b74008ea
2 changed files with 14 additions and 1 deletions

View File

@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- iOS 15: Navigation bar has broken appearance.
- Missing account guidance footer in some providers.
- Files imported via Music (iTunes) File Sharing did not show up.

View File

@ -88,10 +88,22 @@ struct Theme {
extension Theme {
func applyAppearance() {
if #available(iOS 15, *) {
let navBar = UINavigationBarAppearance()
navBar.configureWithOpaqueBackground()
navBar.backgroundColor = palette.primaryBackground
navBar.titleTextAttributes = [.foregroundColor: palette.primaryLightText]
navBar.buttonAppearance.normal.titleTextAttributes = navBar.titleTextAttributes
navBar.doneButtonAppearance.normal.titleTextAttributes = navBar.titleTextAttributes
let appearance = UINavigationBar.appearance()
appearance.standardAppearance = navBar
appearance.scrollEdgeAppearance = appearance.standardAppearance
}
let bar = UINavigationBar.appearance()
bar.barTintColor = palette.primaryBackground
bar.tintColor = palette.primaryLightText
bar.titleTextAttributes = [NSAttributedString.Key.foregroundColor: palette.primaryLightText]
bar.titleTextAttributes = [.foregroundColor: palette.primaryLightText]
bar.largeTitleTextAttributes = bar.titleTextAttributes
let pickerBar = UINavigationBar.appearance(whenContainedInInstancesOf: [UIDocumentBrowserViewController.self])