diff --git a/Examples/Samples/Sources/Base.lproj/Main.storyboard b/Examples/Samples/Sources/Base.lproj/Main.storyboard index f13f16b2..1147ddf7 100644 --- a/Examples/Samples/Sources/Base.lproj/Main.storyboard +++ b/Examples/Samples/Sources/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -39,7 +39,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -125,7 +125,7 @@ - + @@ -142,7 +142,7 @@ - + @@ -163,8 +163,8 @@ - - + + @@ -795,7 +795,7 @@ Section 1.10.33 of "de Finibus Bonorum et Malorum", written by Cicero in 45 BC - + diff --git a/Examples/Samples/Sources/ContentViewControllers/SettingsViewController.swift b/Examples/Samples/Sources/ContentViewControllers/SettingsViewController.swift index d11d0c2a..c19f4c97 100644 --- a/Examples/Samples/Sources/ContentViewControllers/SettingsViewController.swift +++ b/Examples/Samples/Sources/ContentViewControllers/SettingsViewController.swift @@ -4,8 +4,8 @@ import UIKit import FloatingPanel final class SettingsViewController: InspectableViewController { - @IBOutlet weak var largeTitlesSwicth: UISwitch! - @IBOutlet weak var translucentSwicth: UISwitch! + @IBOutlet weak var largeTitlesSwitch: UISwitch! + @IBOutlet weak var translucentSwitch: UISwitch! @IBOutlet weak var versionLabel: UILabel! override func viewDidLoad() { @@ -16,12 +16,12 @@ final class SettingsViewController: InspectableViewController { super.viewDidLayoutSubviews() if #available(iOS 11.0, *) { let prefersLargeTitles = navigationController!.navigationBar.prefersLargeTitles - largeTitlesSwicth.setOn(prefersLargeTitles, animated: false) + largeTitlesSwitch.setOn(prefersLargeTitles, animated: false) } else { - largeTitlesSwicth.isEnabled = false + largeTitlesSwitch.isEnabled = false } let isTranslucent = navigationController!.navigationBar.isTranslucent - translucentSwicth.setOn(isTranslucent, animated: false) + translucentSwitch.setOn(isTranslucent, animated: false) } @IBAction func toggleLargeTitle(_ sender: UISwitch) { @@ -30,7 +30,19 @@ final class SettingsViewController: InspectableViewController { } } @IBAction func toggleTranslucent(_ sender: UISwitch) { - navigationController?.navigationBar.isTranslucent = sender.isOn + // White non-translucent navigation bar, supports dark appearance + if #available(iOS 15, *) { + let appearance = UINavigationBarAppearance() + if sender.isOn { + appearance.configureWithTransparentBackground() + } else { + appearance.configureWithOpaqueBackground() + } + navigationController?.navigationBar.standardAppearance = appearance + navigationController?.navigationBar.scrollEdgeAppearance = appearance + } else { + navigationController?.navigationBar.isTranslucent = sender.isOn + } } }