diff --git a/UINavigationBarDecorator.podspec b/UINavigationBarDecorator.podspec index 9b36841..34533a2 100644 --- a/UINavigationBarDecorator.podspec +++ b/UINavigationBarDecorator.podspec @@ -8,7 +8,7 @@ Pod::Spec.new do |s| s.name = 'UINavigationBarDecorator' - s.version = '1.0.6' + s.version = '1.0.7' s.summary = 'Compatible UINavigationBarAppearance' s.description = 'Compatible UINavigationBarAppearance for all iOS versions' s.homepage = 'https://github.com/pisces/UINavigationBarDecorator' diff --git a/UINavigationBarDecorator/Classes/CompatibleNavigationBarAppearance.swift b/UINavigationBarDecorator/Classes/CompatibleNavigationBarAppearance.swift index 3023ae6..064321d 100644 --- a/UINavigationBarDecorator/Classes/CompatibleNavigationBarAppearance.swift +++ b/UINavigationBarDecorator/Classes/CompatibleNavigationBarAppearance.swift @@ -46,6 +46,7 @@ open class CompatibleNavigationBarAppearance { // MARK: - Open Properties open var isHidden = false + open var isTranslucent = false open var backgroundImageContentMode: UIView.ContentMode = .scaleToFill open var titlePositionAdjustment: UIOffset = .zero open var tintColor: UIColor = .systemBlue @@ -92,14 +93,13 @@ open class CompatibleNavigationBarAppearance { // MARK: - Internal Methods func apply(to navigationBar: UINavigationBar) { + navigationBar.isTranslucent = isTranslucent navigationBar.tintColor = tintColor - setIsTranslucent(to: navigationBar) - if #available(iOS 13.0, *) { return } - + navigationBar.barTintColor = backgroundColor navigationBar.backIndicatorImage = backIndicatorImage navigationBar.backIndicatorTransitionMaskImage = backIndicatorTransitionMaskImage @@ -157,19 +157,6 @@ open class CompatibleNavigationBarAppearance { } return appearance } - - // MARK: - Private Methods - - private func setIsTranslucent(to navigationBar: UINavigationBar) { - switch backgroundMode { - case .default, - .none, - .transparent: - navigationBar.isTranslucent = true - case .opaque: - navigationBar.isTranslucent = false - } - } } private extension UIView {