Skip to content

Commit d46f906

Browse files
committed
Simplify STGutterView background color handling
The `drawsBackground` property was removed in favor of always setting the `backgroundColor` property to `.systemBackground` by default. This simplifies the logic and still allows customizing the background color if needed. The `traitCollectionDidChange` method was updated to resolve the current `backgroundColor`, falling back to `.systemBackground` if it is `nil`.
1 parent 19d0163 commit d46f906

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

Sources/STTextViewUIKit/Gutter/STGutterView.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@ open class STGutterView: UIView {
5454
@Invalidating(.display)
5555
open var highlightSelectedLine: Bool = false
5656

57-
/// A Boolean value that indicates whether the receiver draws its background. Default true.
58-
@Invalidating(.display)
59-
open var drawsBackground: Bool = true
60-
6157
/// The background color of the highlighted line.
6258
@Invalidating(.display)
6359
open var selectedLineHighlightColor: UIColor = .tintColor.withAlphaComponent(0.15)
@@ -116,9 +112,7 @@ open class STGutterView: UIView {
116112

117113
open override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) {
118114
super.traitCollectionDidChange(previousTraitCollection)
119-
if drawsBackground {
120-
backgroundColor = UIColor.systemBackground.resolvedColor(with: traitCollection)
121-
}
115+
backgroundColor = self.backgroundColor?.resolvedColor(with: traitCollection) ?? UIColor.systemBackground.resolvedColor(with: traitCollection)
122116
}
123117

124118
open override func draw(_ rect: CGRect) {

0 commit comments

Comments
 (0)