Conversation
oleksiikolomiietssnapp
approved these changes
Dec 18, 2025
| import SnappTheming | ||
|
|
||
| extension DesignTokensTokenValueExtractor { | ||
| static var number: Self { |
Collaborator
Author
There was a problem hiding this comment.
No, extractors are used internally.
🛡️ Code Coverage Report
Generated by Swift Coverage Action. |
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.
What
This change introduces explicit support for number type design tokens, enabling them to be correctly extracted and converted into SnappThemingDeclaration's metricsCache. A dedicated extractor for number values has been added, and the DesignTokensConverter has been updated to utilize it. Corresponding test cases and resources have also been updated to reflect this new functionality.
Why
Previously, number type design tokens were not explicitly handled and would result in an unsupported token error. By adding explicit support, the system can now correctly parse and utilize numerical design tokens, making the theming system more comprehensive and aligned with the DTCG standard for handling primitive value types. This enhances the utility and flexibility of the design token integration.
Changes
DesignTokensConverter.swift: Updated to specifically handle number type tokens, routing them to the new extractor instead of marking them as unsupported.design.tokens.json(test resource): Added a new number type token (number.aspect.square) for testing.expected.snapptheming.json(test resource): Updated to include the expected output for the newly supported number token.SnappThemingDesignTokensParserTests.swift: Modified a test case to reflect that number tokens are now supported, and fontWeight remains unsupported, ensuring correct error handling for other unhandled types.