Skip to content

Add Text custom attribute support - #895

Merged
Kyle-Ye merged 2 commits into
mainfrom
feature/text_attribute
Jun 7, 2026
Merged

Add Text custom attribute support#895
Kyle-Ye merged 2 commits into
mainfrom
feature/text_attribute

Conversation

@Kyle-Ye

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

Copy link
Copy Markdown
Member

Agent Summary

  • Add Text.Superscript and Text.CustomAttributes support

@github-actions github-actions Bot added area: text Text, labels, line style, and text rendering APIs. type: feature New API, behavior, platform support, or user-facing capability. labels Jun 7, 2026
@Kyle-Ye
Kyle-Ye marked this pull request as ready for review June 7, 2026 09:29
@augmentcode

augmentcode Bot commented Jun 7, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR wires up initial support for attaching/querying custom text attributes and introduces a marker type for superscript.

Changes:

  • Makes TextAttribute Hashable and adds Text.customAttribute(_:) to attach attributes via an internal text modifier
  • Adds a TextAttributeModifierBase + generic modifier implementation that stores attributes into Text.Style.customAttributes
  • Introduces SPI Text.CustomAttributes as a container with add and type-based subscript lookup
  • Moves superscript/custom-attribute plumbing out of the AttributedString file and adds Text.Superscript as a standalone marker type

Technical Notes: Attribute transfer from AttributedString populates Text.Style.superscript and Text.Style.customAttributes for later renderer/layout consumption.

🤖 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.

attributes.append(TextAttributeModifier(value: value))
}

public subscript<T>(_ key: T.Type) -> T? where T: TextAttribute {

@augmentcode augmentcode Bot Jun 7, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The doc comment on customAttribute says “Only one attribute of each type … with inner attributes taking precedence”, but CustomAttributes.subscript returns the first match in attributes order and add/modify only append; if multiple values of the same TextAttribute type are present this will likely return the outer/earlier one instead of the inner/later one.

Severity: medium

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

@codecov

codecov Bot commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.71%. Comparing base (1278862) to head (8f1e074).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...OpenSwiftUICore/View/Text/Text/Text+Renderer.swift 0.00% 26 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #895      +/-   ##
==========================================
+ Coverage   26.68%   26.71%   +0.02%     
==========================================
  Files         694      697       +3     
  Lines       48683    48907     +224     
==========================================
+ Hits        12993    13065      +72     
- Misses      35690    35842     +152     

☔ View full report in Codecov by Harness.
📢 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 ded2a87 into main Jun 7, 2026
8 checks passed
@Kyle-Ye
Kyle-Ye deleted the feature/text_attribute branch June 7, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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