Skip to content

Commit

Permalink
Fix how tint color is used for value label text colors
Browse files Browse the repository at this point in the history
  • Loading branch information
ipodishima committed Jan 16, 2023
1 parent 86755d9 commit 7806ad1
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 7806ad1

Please sign in to comment.