Skip to content

Commit 9362764

Browse files
committed
Updated selected color for table view cell.
1 parent 193c4e3 commit 9362764

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

Sources/SparrowKit/UIKit/Classes/Table/SPTableViewCell.swift

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,20 +66,27 @@ open class SPTableViewCell: UITableViewCell {
6666

6767
No need ovveride other init. Using one function for configurate view.
6868
*/
69-
open func commonInit() {
70-
if #available(iOS 13.0, *) {
71-
selectedBackgroundView = UIView()
72-
#if os(iOS)
73-
selectedColor = UIColor.systemGray5
74-
#endif
75-
}
76-
}
69+
open func commonInit() {}
7770

7871
// MARK: - Lifecycle
7972

8073
open override func prepareForReuse() {
8174
super.prepareForReuse()
8275
currentIndexPath = nil
8376
}
77+
78+
open override func tintColorDidChange() {
79+
super.tintColorDidChange()
80+
if #available(iOS 13.0, *) {
81+
#if os(iOS)
82+
selectedColor = UIColor.init(
83+
// For light always good .systemGray5
84+
light: .systemGray5,
85+
// For dark some cases may have same color like background.
86+
dark: backgroundColor?.mixWithColor(.white, amount: 0.06) ?? .systemGray4
87+
)
88+
#endif
89+
}
90+
}
8491
}
8592
#endif

0 commit comments

Comments
 (0)