Skip to content

Add Text formatter storage support#891

Merged
Kyle-Ye merged 3 commits into
mainfrom
feature/formatter
Jun 1, 2026
Merged

Add Text formatter storage support#891
Kyle-Ye merged 3 commits into
mainfrom
feature/formatter

Conversation

@Kyle-Ye
Copy link
Copy Markdown
Member

@Kyle-Ye Kyle-Ye commented Jun 1, 2026

Agent Summary

Adds formatter-backed Text storage support and format-style handling for OpenSwiftUI text initialization.

Changes

  • Add Text initializers backed by Formatter and FormatStyle storage.
  • Resolve format-style output using environment locale, calendar, time zone, interface idiom, text alignment, capitalization context, and text size variant.
  • Add size-variant helpers for Foundation.FormatStyle and TextSizeVariant.
  • Add focused formatter storage tests.
  • Add a reusable Shared TextFormatStyleExample and a disabled UI snapshot test covering the documented date format-style example.

@github-actions github-actions Bot added area: example Example apps, previews, sample projects, screenshots, or demo assets. area: tests Test suites, UI tests, fixtures, snapshots, and test support code. area: text Text, labels, line style, and text rendering APIs. type: feature New API, behavior, platform support, or user-facing capability. labels Jun 1, 2026
@Kyle-Ye Kyle-Ye marked this pull request as ready for review June 1, 2026 17:32
@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented Jun 1, 2026

🤖 Augment PR Summary

Summary: This PR implements formatter- and format-style-backed storage for Text, enabling OpenSwiftUI to initialize and resolve text from Foundation Formatter and FormatStyle values.

Changes:

  • Adds Text initializers for Formatter (NSObject and ReferenceConvertible subjects) plus new storage types that resolve via the current EnvironmentValues.
  • Implements Text(_:format:) for FormatStyle outputs to both String (v3) and AttributedString (v6), including environment-driven resolution (locale, calendar, time zone, interface idiom, alignment, capitalization context).
  • Introduces size-variant adaptation helpers (SizeAdaptiveFormatStyle, FormatStyle.sizeVariant/exactSizeVariant) and a TextSizeVariant.adjust() utility.
  • Adds focused unit tests for formatter storage and format-style storage behavior/equality.
  • Adds a reusable shared example view plus a disabled snapshot UI test covering the documented date format-style example.

Technical Notes: Format resolution is environment-sensitive and includes platform-specific handling for converting AttributedString to NSAttributedString when needed.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. 1 suggestion posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread Sources/OpenSwiftUICore/View/Text/Text/Text+Formatter.swift
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.79%. Comparing base (7f79072) to head (affe110).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...penSwiftUICore/View/Text/Text/Text+Formatter.swift 71.76% 24 Missing ⚠️
...iew/Text/FormatStyle/SizeAdaptiveFormatStyle.swift 27.27% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #891      +/-   ##
==========================================
+ Coverage   26.50%   26.79%   +0.28%     
==========================================
  Files         689      690       +1     
  Lines       48193    48287      +94     
==========================================
+ Hits        12774    12938     +164     
+ Misses      35419    35349      -70     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Kyle-Ye Kyle-Ye merged commit 1d01474 into main Jun 1, 2026
6 of 7 checks passed
@Kyle-Ye Kyle-Ye deleted the feature/formatter branch June 1, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: example Example apps, previews, sample projects, screenshots, or demo assets. area: tests Test suites, UI tests, fixtures, snapshots, and test support code. area: text Text, labels, line style, and text rendering APIs. type: feature New API, behavior, platform support, or user-facing capability.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant