Repository navigation
Conversation
Shared helper for the recurring "localized template + emphasize one substring" pattern, so apps stop reimplementing it locally. - AttributeContainer.stronglyEmphasized — bold default via inlinePresentationIntent (intent, not a pinned font). - AttributedString.emphasizing(_:in:with:) — takes an AttributeContainer, defaulting to .stronglyEmphasized. - AttributedString.emphasizing(_:in:style:) — TextStyle overload built on stylize(with:), #if canImport(UIKit) gated to match TextStyle.
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Shared helper for the recurring "localized template + emphasize one substring" AttributedString pattern (bolding an email in a sentence, etc.), which several apps have each reimplemented locally.
AttributeContainer.stronglyEmphasized— bold default viainlinePresentationIntent(an intent, not a pinned font, so it renders bold in SwiftUIText+ UIKit and survives Dynamic Type).AttributedString.emphasizing(_:in:with:)— applies anAttributeContainer(default.stronglyEmphasized) to the first occurrence of the substring; returns the template unchanged when the substring is empty or absent.AttributedString.emphasizing(_:in:style:)—TextStyleoverload built on the existingstylize(with:),#if canImport(UIKit)-gated to matchTextStyle.Tests cover both overloads (macOS for the container API, iOS for the
TextStylepath). Verified withswift testandxcodebuild build-for-testing -destination 'generic/platform=iOS Simulator'; SwiftLint clean.