Skip to content

Add environment-configurable formatter support - #884

Merged
Kyle-Ye merged 3 commits into
mainfrom
feature/EnvironmentConfigurableFormatter
May 30, 2026
Merged

Add environment-configurable formatter support#884
Kyle-Ye merged 3 commits into
mainfrom
feature/EnvironmentConfigurableFormatter

Conversation

@Kyle-Ye

@Kyle-Ye Kyle-Ye commented May 30, 2026

Copy link
Copy Markdown
Member

Summary

  • Add EnvironmentConfigurableFormatter for applying EnvironmentValues to Foundation formatters used by text formatting.
  • Configure supported formatter types with environment locale, calendar, and time zone where applicable.
  • Gate formatter conformances that are only available on Apple platforms.
  • Add DocC comments and Swift Testing coverage for each formatter conformance.

Testing

  • swift build
  • swift build --target OpenSwiftUICoreTests
  • swift test --scratch-path .build-env-formatter-test --disable-experimental-prebuilts --filter 'OpenSwiftUICoreTests.EnvironmentConfigurableFormatterTests'\n- Linux swift build --build-path .build-linux with OPENSWIFTUI_LIB_SWIFT_PATH

@github-actions github-actions Bot added area: data-flow State, binding, environment, preference, observation, or property data flow. area: text Text, labels, line style, and text rendering APIs. type: feature New API, behavior, platform support, or user-facing capability. labels May 30, 2026
@Kyle-Ye
Kyle-Ye marked this pull request as ready for review May 30, 2026 10:35
@augmentcode

augmentcode Bot commented May 30, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: Adds a small internal protocol to make Foundation formatters apply text-related EnvironmentValues before producing output.

Changes:

  • Introduces EnvironmentConfigurableFormatter with configure(in:) as a standardized hook for environment-driven formatter configuration.
  • Adds conformances for DateFormatter, ISO8601DateFormatter, DateIntervalFormatter, and NumberFormatter to apply locale/calendar/time-zone as appropriate.
  • Adds additional conformances for measurement/unit formatters (with MeasurementFormatter/DateComponentsFormatter gated to Darwin where needed).
  • Documents the intent and scope of environment-driven configuration in DocC-style comments.
  • Adds Swift Testing coverage to validate each formatter type picks up the expected environment values.

Technical Notes: The configuration focuses on properties that directly affect formatted text output (locale/calendar/time zone) and keeps platform availability differences behind conditional compilation.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

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.

@codecov

codecov Bot commented May 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 26.92%. Comparing base (5bba281) to head (1520e5f).

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #884       +/-   ##
===========================================
+ Coverage   13.79%   26.92%   +13.12%     
===========================================
  Files         639      679       +40     
  Lines       41360    47281     +5921     
===========================================
+ Hits         5706    12730     +7024     
+ Misses      35654    34551     -1103     

☔ 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 e3b18c6 into main May 30, 2026
7 of 8 checks passed
@Kyle-Ye
Kyle-Ye deleted the feature/EnvironmentConfigurableFormatter branch May 30, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: data-flow State, binding, environment, preference, observation, or property data flow. 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