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.
Overview:
This pull request adds a new structure,
TextStyle
, to the codebase, which provides a comprehensive way to define and apply text styles in SwiftUI applications. TheTextStyle
structure allows developers to specify various attributes such as font type, size, line height, font scaling, letter spacing, text case, and text decoration. The primary goal of this enhancement is to simplify the process of translating text styles from Figma designs into SwiftUI, ensuring consistency and ease of use.Usage:
Developers can apply the text style to views using the
textStyle(_:)
modifier or specifically toText
views with thetextStyleText(_:)
modifier. Thestylize(with:)
method allows applying the text style to attributed strings, and an initializer forNSAttributedString
simplifies the creation of attributed strings with the specified text style.Example:
Notes:
The textStyleText(_:) modifier and the stylize(with:) method do not apply line spacing, text case, or vertical padding based on line height.
This enhancement aims to streamline the integration of text styles from Figma designs into the SwiftUI framework, improving code maintainability and visual consistency across the application.