listless

A simple list app for Apple platforms
Log | Files | Refs | README | LICENSE

commit 70be346be50f71014b8f4567f5df75d2c63e1bc1
parent 8a835f1a98b20bca588a168a48c448546dc3c4d8
Author: Michael Camilleri <[email protected]>
Date:   Fri, 27 Feb 2026 07:46:51 +0900

Improve font metrics

Co-Authored-By: Codex GPT 5.3 <[email protected]>

Diffstat:
MListlessiOS/Helpers/TappableTextField.swift | 6+++---
MListlessiOS/Helpers/TaskRowMetrics.swift | 14++++++++++++++
MListlessiOS/Views/PullToClear.swift | 2+-
MListlessiOS/Views/PullToCreate.swift | 2+-
MListlessiOS/Views/TaskListView.swift | 2+-
5 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/ListlessiOS/Helpers/TappableTextField.swift b/ListlessiOS/Helpers/TappableTextField.swift @@ -13,7 +13,7 @@ struct TappableTextField: UIViewRepresentable { func makeUIView(context: Context) -> UITextView { let textView = UITextView() textView.delegate = context.coordinator - textView.font = .systemFont(ofSize: 18) + textView.font = TaskRowMetrics.bodyUIK textView.backgroundColor = .clear textView.textContainerInset = .zero textView.textContainer.lineFragmentPadding = 0 @@ -24,7 +24,7 @@ struct TappableTextField: UIViewRepresentable { let placeholder = UILabel() placeholder.text = "Enter task" - placeholder.font = .systemFont(ofSize: 18) + placeholder.font = TaskRowMetrics.bodyUIK placeholder.textColor = .placeholderText placeholder.tag = 100 placeholder.translatesAutoresizingMaskIntoConstraints = false @@ -61,7 +61,7 @@ struct TappableTextField: UIViewRepresentable { private func applyStyle(to textView: UITextView, text: String, isCompleted: Bool) { var attributes: [NSAttributedString.Key: Any] = [ - .font: UIFont.systemFont(ofSize: 18), + .font: TaskRowMetrics.bodyUIK, .foregroundColor: isCompleted ? UIColor.secondaryLabel : UIColor.label, ] if isCompleted { diff --git a/ListlessiOS/Helpers/TaskRowMetrics.swift b/ListlessiOS/Helpers/TaskRowMetrics.swift @@ -1,6 +1,20 @@ import CoreGraphics +import SwiftUI +import UIKit enum TaskRowMetrics { + /// Base task-title font size (18pt), scaled by Dynamic Type. + static let bodyUIK: UIFont = UIFontMetrics(forTextStyle: .body) + .scaledFont(for: .systemFont(ofSize: 18)) + /// SwiftUI equivalent for use in pure SwiftUI views (e.g. PullToCreate). + static let bodySUI: Font = .system(size: 18, weight: .regular) + + /// Hint font (17pt), scaled by Dynamic Type. + static let hintUIK: UIFont = UIFontMetrics(forTextStyle: .body) + .scaledFont(for: .systemFont(ofSize: 17)) + /// SwiftUI equivalent for use in pure SwiftUI views. + static let hintSUI: Font = .system(size: 17, weight: .regular) + static let accentBarWidth: CGFloat = 8 static let trailingCornerRadius: CGFloat = 14 static let contentSpacing: CGFloat = 12 diff --git a/ListlessiOS/Views/PullToClear.swift b/ListlessiOS/Views/PullToClear.swift @@ -31,7 +31,7 @@ struct PullToClearIndicator: View { .offset(y: isReady ? -textSlideDistance : 0) } .foregroundStyle(.secondary) - .font(.body) + .font(TaskRowMetrics.hintSUI) .frame(height: textSlideDistance, alignment: .topLeading) .clipped() .animation(.easeInOut(duration: 0.15), value: isReady) diff --git a/ListlessiOS/Views/PullToCreate.swift b/ListlessiOS/Views/PullToCreate.swift @@ -26,7 +26,7 @@ struct PullToCreateIndicator: View { .offset(y: isReady ? textSlideDistance : 0) } .foregroundStyle(.secondary) - .font(.body) + .font(TaskRowMetrics.bodySUI) .frame(height: textSlideDistance, alignment: .topLeading) .clipped() .animation(.easeInOut(duration: 0.18), value: isReady) diff --git a/ListlessiOS/Views/TaskListView.swift b/ListlessiOS/Views/TaskListView.swift @@ -266,7 +266,7 @@ struct TaskListView: View, TaskListViewProtocol { .overlay { if isCompletelyEmpty { Text("Pull down to create") - .font(.subheadline) + .font(TaskRowMetrics.hintSUI) .foregroundStyle(.secondary) .padding(.top, 24) .allowsHitTesting(false)