Skip to content

Commit

Permalink
Merge branch 'release/1.0.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
pisces committed Jun 1, 2021
2 parents 8be000a + 7617a17 commit e84a9e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion UINavigationBarDecorator.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit e84a9e3

Please sign in to comment.