AppDelegate+Swift.swift 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // AppDelegate+Swift.swift
  3. // Nextcloud
  4. //
  5. // Created by Philippe Weidmann on 24.04.20.
  6. // Copyright © 2020 Marino Faggiana. All rights reserved.
  7. //
  8. import Foundation
  9. extension AppDelegate {
  10. @objc func configureNavBarForViewController(_ viewController: UIViewController) {
  11. if #available(iOS 13.0, *) {
  12. var navBarAppearance = UINavigationBarAppearance()
  13. navBarAppearance.configureWithOpaqueBackground()
  14. navBarAppearance.shadowColor = .clear
  15. navBarAppearance.shadowImage = UIImage()
  16. viewController.navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
  17. navBarAppearance = UINavigationBarAppearance()
  18. navBarAppearance.configureWithOpaqueBackground()
  19. navBarAppearance.backgroundColor = .systemBackground
  20. viewController.navigationController?.navigationBar.standardAppearance = navBarAppearance
  21. } else {
  22. viewController.navigationController?.navigationBar.barStyle = .default
  23. viewController.navigationController?.navigationBar.barTintColor = NCBrandColor.sharedInstance.backgroundView
  24. viewController.navigationController?.navigationBar.titleTextAttributes = [NSAttributedString.Key.foregroundColor:NCBrandColor.sharedInstance.textView]
  25. if #available(iOS 11.0, *) {
  26. viewController.navigationController?.navigationBar.largeTitleTextAttributes = [NSAttributedString.Key.foregroundColor:NCBrandColor.sharedInstance.textView]
  27. }
  28. }
  29. viewController.navigationController?.navigationBar.tintColor = NCBrandColor.sharedInstance.brand
  30. }
  31. }