Skip to content

Add image attachment support to Text#941

Merged
Kyle-Ye merged 1 commit into
mainfrom
feature/text_image
Jul 19, 2026
Merged

Add image attachment support to Text#941
Kyle-Ye merged 1 commit into
mainfrom
feature/text_image

Conversation

@Kyle-Ye

@Kyle-Ye Kyle-Ye commented Jul 19, 2026

Copy link
Copy Markdown
Member

Summary

  • Add Text.init(_ image:) for embedding images in text.
  • Support Image interpolation in LocalizedStringKey.
  • Resolve image attachments through text storage, including named-image auxiliary metadata.

@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 Jul 19, 2026
@Kyle-Ye
Kyle-Ye marked this pull request as ready for review July 19, 2026 03:46
@augmentcode

augmentcode Bot commented Jul 19, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR adds support for embedding images directly into Text and localized string interpolations.

Changes:

  • Introduces Text.init(_ image: Image) backed by a new attachment-based text storage
  • Adds LocalizedStringKey.StringInterpolation.appendInterpolation(_ image: Image) to allow "... \(Image)" usage
  • Resolves attachments through AnyTextStorage, with a widget/metadata path via .writeAuxiliaryMetadata and named-image resolution
  • Adds tests for equality behavior and attachment resolution to the object replacement character

Technical Notes: Attachment resolution uses ImageResolutionContext and can emit a named-image attachment when auxiliary metadata is requested.

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

options: Text.ResolveOptions
) -> Bool where T: ResolvedTextContainer {
guard options.contains(.writeAuxiliaryMetadata),
let image = image.resolveNamedImage(in: context)

@augmentcode augmentcode Bot Jul 19, 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.

Sources/OpenSwiftUICore/View/Text/Text/Text+Image.swift:L96: image.resolveNamedImage(in:) internally calls resolve(in:); when it returns nil (e.g., missing named asset) the fallback path resolves again, which can duplicate the external warning log and do the resolution work twice on the error path.

Severity: low

Fix This in Augment

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

@codecov

codecov Bot commented Jul 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.80952% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 26.36%. Comparing base (94b21c0) to head (581f1e0).

Files with missing lines Patch % Lines
...es/OpenSwiftUICore/View/Text/Text/Text+Image.swift 73.80% 11 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #941      +/-   ##
==========================================
+ Coverage   25.68%   26.36%   +0.67%     
==========================================
  Files         722      723       +1     
  Lines       51190    51232      +42     
==========================================
+ Hits        13150    13506     +356     
+ Misses      38040    37726     -314     

☔ 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 4c426a7 into main Jul 19, 2026
9 checks passed
@Kyle-Ye
Kyle-Ye deleted the feature/text_image branch July 19, 2026 04:37
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