From 521e5ad5fc123c7066d8c75d35969a448afc2680 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sun, 22 Jan 2023 17:22:07 -0500 Subject: [PATCH] Make trend history view respond to preferred content size category --- Tusker/Views/TrendHistoryView.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tusker/Views/TrendHistoryView.swift b/Tusker/Views/TrendHistoryView.swift index 00a0c845..ffdb556a 100644 --- a/Tusker/Views/TrendHistoryView.swift +++ b/Tusker/Views/TrendHistoryView.swift @@ -97,7 +97,7 @@ class TrendHistoryView: UIView { borderLayer.path = path.cgPath.copy()! borderLayer.strokeColor = tintColor.cgColor borderLayer.fillColor = nil - borderLayer.lineWidth = 2 + borderLayer.lineWidth = lineWidth borderLayer.lineCap = .round path.addLine(to: CGPoint(x: bounds.width, y: bounds.height)) @@ -109,12 +109,16 @@ class TrendHistoryView: UIView { let fillColor = self.fillColor() fillLayer.strokeColor = fillColor fillLayer.fillColor = fillColor - fillLayer.lineWidth = 2 + fillLayer.lineWidth = lineWidth layer.addSublayer(fillLayer) layer.addSublayer(borderLayer) } + private var lineWidth: CGFloat { + (traitCollection.preferredContentSizeCategory > .large || UIAccessibility.isBoldTextEnabled) ? 4 : 2 + } + // The non-transparent fill color. // We blend with the view's background color ourselves so that final color is non-transparent, // otherwise when the fill layer's border and fill overlap, there's a visibly darker patch