Skip to content

Commit

Permalink
Merge pull request #28 from ipodishima/fix/tintColor
Browse files Browse the repository at this point in the history
Fix how tint color is used for value label text colors
  • Loading branch information
malcommac committed Aug 31, 2023
2 parents 291b183 + 7806ad1 commit caceaf9
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ public class FlagsBrowserDefaultCell: UITableViewCell, Reusable, NibType {

public var isDisabled: Bool = false {
didSet {
titlelabel.textColor = (isDisabled ? .lightGray : .black)
valueLabel?.textColor = (isDisabled ? .red : .tintColor)
subtitleLabel.textColor = (isDisabled ? .lightGray : .darkGray)
updateTextColors()
}
}

public static var nibBundle: Bundle {
.libraryBundle
}

private func updateTextColors() {
titlelabel.textColor = (isDisabled ? .lightGray : .black)
valueLabel?.textColor = (isDisabled ? .red : tintColor)
subtitleLabel.textColor = (isDisabled ? .lightGray : .darkGray)
}

// MARK: - Public Functions

Expand All @@ -55,15 +59,10 @@ public class FlagsBrowserDefaultCell: UITableViewCell, Reusable, NibType {
super.prepareForReuse()
self.isDisabled = false
}

}

// MARK: - UIColor Extension
public override func tintColorDidChange() {
super.tintColorDidChange()

extension UIColor {

static var tintColor: UIColor {
UIApplication.shared.windows.first?.rootViewController?.view.tintColor ?? .blue
updateTextColors()
}

}

0 comments on commit caceaf9

Please sign in to comment.